From 638f4cae8999add55283ec2ff4bc9431cb0a96f8 Mon Sep 17 00:00:00 2001 From: Sky Z Date: Thu, 14 Jul 2022 01:28:51 -0400 Subject: [PATCH] Add select multiple streams Former-commit-id: df40eeede911ba5114fcf21c9860dd4562aeda76 --- FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs index 7b3da7a..171264e 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs @@ -1,6 +1,7 @@ using System; +using System.Collections.Generic; using System.Drawing; - +using System.Linq; using FFMpegCore.Arguments; using FFMpegCore.Enums; @@ -61,6 +62,8 @@ public FFMpegArgumentOptions WithAudioFilters(Action audioFi public FFMpegArgumentOptions Loop(int times) => WithArgument(new LoopArgument(times)); public FFMpegArgumentOptions OverwriteExisting() => WithArgument(new OverwriteArgument()); public FFMpegArgumentOptions SelectStream(int streamIndex, int inputFileIndex = 0) => WithArgument(new MapStreamArgument(streamIndex, inputFileIndex)); + public FFMpegArgumentOptions SelectStreams(IEnumerable streamIndices, int inputFileIndex = 0) => + streamIndices.Aggregate(this, (options, streamIndex) => options.SelectStream(streamIndex, inputFileIndex)); public FFMpegArgumentOptions ForceFormat(ContainerFormat format) => WithArgument(new ForceFormatArgument(format)); public FFMpegArgumentOptions ForceFormat(string format) => WithArgument(new ForceFormatArgument(format));