mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Add "GifPalettArgument" for outputting GIFs
This commit is contained in:
parent
718371505c
commit
4dbbf345d4
1 changed files with 21 additions and 0 deletions
21
FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs
Normal file
21
FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs
Normal 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\"";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue