mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 10:05:44 +00:00
23 lines
669 B
C#
23 lines
669 B
C#
using System.Drawing;
|
|
|
|
namespace FFMpegCore.Arguments;
|
|
|
|
public class GifPaletteArgument : IArgument
|
|
{
|
|
private readonly int _fps;
|
|
|
|
private readonly Size? _size;
|
|
private readonly int _streamIndex;
|
|
|
|
public GifPaletteArgument(int streamIndex, int fps, Size? size)
|
|
{
|
|
_streamIndex = streamIndex;
|
|
_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 \"[{_streamIndex}:v] fps={_fps},{ScaleText}split [a][b];[a] palettegen=max_colors=32 [p];[b][p] paletteuse=dither=bayer\"";
|
|
}
|