Add "GifPalettArgument" for outputting GIFs

This commit is contained in:
Rafael Carvalho 2023-03-06 17:25:08 +13:00
parent 718371505c
commit 4dbbf345d4

View file

@ -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\"";
}
}