fix stream index for passing to ffmpeg while making a snapshot

Former-commit-id: 26fcfcc206
This commit is contained in:
Stanislau Krashynski 2021-09-20 16:06:43 +03:00
parent feaeb7478e
commit 849eb3ce54

View file

@ -116,7 +116,12 @@ private static (FFMpegArguments, Action<FFMpegArgumentOptions> outputOptions) Bu
{
captureTime ??= TimeSpan.FromSeconds(source.Duration.TotalSeconds / 3);
size = PrepareSnapshotSize(source, size);
streamIndex = streamIndex == null ? 0 : source.VideoStreams.FirstOrDefault(videoStream => videoStream.Index == streamIndex).Index;
if (streamIndex == null)
{
streamIndex = source.PrimaryVideoStream?.Index
?? source.VideoStreams.First()?.Index
?? 0;
}
return (FFMpegArguments
.FromFileInput(input, false, options => options