diff --git a/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs b/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs new file mode 100644 index 0000000..408832d --- /dev/null +++ b/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs @@ -0,0 +1,21 @@ +using System.Drawing; + +namespace FFMpegCore.Arguments +{ + public class GifPalettArgument : IArgument + { + private readonly int _fps; + + private readonly Size? _size; + + public GifPalettArgument(int fps, Size? size) + { + _fps = fps; + _size = size; + } + + private string ScaleText => _size.HasValue ? $"scale=w={_size.Value.Width}:h={_size.Value.Height}," : string.Empty; + + public string Text => $"-filter_complex \"[0:v] fps={_fps},{ScaleText}split [a][b];[a] palettegen=max_colors=32 [p];[b][p] paletteuse=dither=bayer\""; + } +}