From 170aefeb32513a9f7e2c4c4e8a1a8642de259908 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 27 Feb 2020 18:28:49 +0100 Subject: [PATCH] Support for crf --- .../Atoms/ConstantRateFactorArgument.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 FFMpegCore/FFMPEG/Argument/Atoms/ConstantRateFactorArgument.cs diff --git a/FFMpegCore/FFMPEG/Argument/Atoms/ConstantRateFactorArgument.cs b/FFMpegCore/FFMPEG/Argument/Atoms/ConstantRateFactorArgument.cs new file mode 100644 index 0000000..a753e78 --- /dev/null +++ b/FFMpegCore/FFMPEG/Argument/Atoms/ConstantRateFactorArgument.cs @@ -0,0 +1,41 @@ +using System; + +namespace FFMpegCore.FFMPEG.Argument +{ + /// + /// Constant Rate Factor (CRF) argument + /// + public class ConstantRateFactorArgument : Argument + { + public ConstantRateFactorArgument(int crf) : base(crf) + { + if (crf < 0 || crf > 63) + { + throw new ArgumentException("Argument is outside range (0 - 63)", nameof(crf)); + } + } + + public override string GetStringValue() + { + return $"-crf {Value} "; + } + } + /// + /// Constant Rate Factor (CRF) argument + /// + public class Variable : Argument + { + public ConstantRateFactorArgument(int crf) : base(crf) + { + if (crf < 0 || crf > 63) + { + throw new ArgumentException("Argument is outside range (0 - 63)", nameof(crf)); + } + } + + public override string GetStringValue() + { + return $"-crf {Value} "; + } + } +} \ No newline at end of file