diff --git a/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs b/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs index 408832d..9c95045 100644 --- a/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/GifPalettArgument.cs @@ -4,18 +4,21 @@ namespace FFMpegCore.Arguments { public class GifPalettArgument : IArgument { + private readonly int _streamIndex; + private readonly int _fps; private readonly Size? _size; - public GifPalettArgument(int fps, Size? size) + public GifPalettArgument(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 \"[0:v] fps={_fps},{ScaleText}split [a][b];[a] palettegen=max_colors=32 [p];[b][p] paletteuse=dither=bayer\""; + public string Text => $"-filter_complex \"[{_streamIndex}:v] fps={_fps},{ScaleText}split [a][b];[a] palettegen=max_colors=32 [p];[b][p] paletteuse=dither=bayer\""; } } diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs index 635ef29..25394e2 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs @@ -76,7 +76,7 @@ public FFMpegArgumentOptions DeselectStreams(IEnumerable streamIndices, int public FFMpegArgumentOptions WithAudibleEncryptionKeys(string key, string iv) => WithArgument(new AudibleEncryptionKeyArgument(key, iv)); public FFMpegArgumentOptions WithAudibleActivationBytes(string activationBytes) => WithArgument(new AudibleEncryptionKeyArgument(activationBytes)); public FFMpegArgumentOptions WithTagVersion(int id3v2Version = 3) => WithArgument(new ID3V2VersionArgument(id3v2Version)); - public FFMpegArgumentOptions WithGifPalettArgument(Size? size, int fps = 12) => WithArgument(new GifPalettArgument(fps, size)); + public FFMpegArgumentOptions WithGifPalettArgument(int streamIndex, Size? size, int fps = 12) => WithArgument(new GifPalettArgument(streamIndex, fps, size)); public FFMpegArgumentOptions WithArgument(IArgument argument) {