Skip to content

Commit fba8b87

Browse files
committed
Only map video streams when using fixed format encoder (GIF/JPEG/PNG)
1 parent 2357def commit fba8b87

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ff-utils-winforms/UI/Tasks/QuickConvert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static async Task Run()
4545

4646
string inFiles = TrackList.GetInputFilesString();
4747
string outPath = GetOutPath(vCodec);
48-
string map = TrackList.GetMapArgs();
48+
string map = TrackList.GetMapArgs(vCodec.IsFixedFormat);
4949
string a = anyAudioStreams ? CodecUtils.GetCodec(aCodec).GetArgs(GetAudioArgsFromUi(), TrackList.current.File).Arguments : "";
5050
string s = CodecUtils.GetCodec(sCodec).GetArgs().Arguments;
5151
string meta = GetMetadataArgs();

ff-utils-winforms/UI/TrackList.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static string GetInputFilesString()
233233
return string.Join(" ", args);
234234
}
235235

236-
public static string GetMapArgs()
236+
public static string GetMapArgs(bool videoOnly = false)
237237
{
238238
List<string> args = new List<string>();
239239
List<int> fileIndexesToMap = new List<int>();
@@ -250,7 +250,8 @@ public static string GetMapArgs()
250250
if (!fileIndexesToMap.Contains(fileIdx))
251251
fileIndexesToMap.Add(fileIdx);
252252

253-
args.Add($"-map {fileIdx}:{entry.Stream.Index}");
253+
if(!(videoOnly && entry.Stream.Type != Stream.StreamType.Video)) // Skip all non-video streams if videoOnly == true
254+
args.Add($"-map {fileIdx}:{entry.Stream.Index}");
254255
}
255256
}
256257

0 commit comments

Comments
 (0)