-map filtering

Add map filtering to choose videostream


Former-commit-id: e60fb71ff8
This commit is contained in:
Fedor Zhilkin 2020-09-17 20:50:38 +03:00
parent 726e8cd486
commit f6132e2eba
2 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,17 @@
namespace FFMpegCore.Arguments
{
/// <summary>
/// Represents choice of video stream, works with one input file
/// </summary>
public class MapStreamArgument : IArgument
{
public readonly int VideoStream;
public MapStreamArgument(int videoStreamNum)
{
VideoStream = videoStreamNum;
}
public string Text => $"-map 0:{VideoStream}";
}
}

View file

@ -59,6 +59,7 @@ private FFMpegArguments(IInputArgument inputArgument)
public FFMpegArguments WithDuration(TimeSpan? duration) => WithArgument(new DurationArgument(duration)); public FFMpegArguments WithDuration(TimeSpan? duration) => WithArgument(new DurationArgument(duration));
public FFMpegArguments WithFastStart() => WithArgument(new FaststartArgument()); public FFMpegArguments WithFastStart() => WithArgument(new FaststartArgument());
public FFMpegArguments WithFrameOutputCount(int frames) => WithArgument(new FrameOutputCountArgument(frames)); public FFMpegArguments WithFrameOutputCount(int frames) => WithArgument(new FrameOutputCountArgument(frames));
public FFMpegArguments WithVideoStream(int videoStreamNumber) => WithArgument(new MapStreamArgument(videoStreamNumber));
public FFMpegArguments UsingShortest(bool shortest = true) => WithArgument(new ShortestArgument(shortest)); public FFMpegArguments UsingShortest(bool shortest = true) => WithArgument(new ShortestArgument(shortest));
public FFMpegArguments UsingMultithreading(bool multithread) => WithArgument(new ThreadsArgument(multithread)); public FFMpegArguments UsingMultithreading(bool multithread) => WithArgument(new ThreadsArgument(multithread));