diff --git a/Code/Main/CreateVideo.cs b/Code/Main/CreateVideo.cs index 94df313..437047e 100644 --- a/Code/Main/CreateVideo.cs +++ b/Code/Main/CreateVideo.cs @@ -209,7 +209,10 @@ namespace Flowframes.Main public static async Task MuxOutputVideo(string inputPath, string outVideo) { - bool muxFromInput = true; + if (!Config.GetBool("keepAudio") && !Config.GetBool("keepAudio")) + return; + + bool muxFromInput = Config.GetInt("audioSubTransferMode") == 0; try { diff --git a/Code/Main/Interpolate.cs b/Code/Main/Interpolate.cs index 396f8ae..c43e4a7 100644 --- a/Code/Main/Interpolate.cs +++ b/Code/Main/Interpolate.cs @@ -107,7 +107,7 @@ namespace Flowframes if (canceled) return; - if (Config.GetBool("keepAudio")) + if (Config.GetBool("keepAudio") && Config.GetInt("audioSubTransferMode") == 1) { Program.mainForm.SetStatus("Extracting audio from video..."); await FfmpegAudioAndMetadata.ExtractAudioTracks(inPath, current.tempFolder); @@ -115,7 +115,7 @@ namespace Flowframes if (canceled) return; - if (Config.GetBool("keepSubs")) + if (Config.GetBool("keepSubs") && Config.GetInt("audioSubTransferMode") == 1) { Program.mainForm.SetStatus("Extracting subtitles from video..."); await FfmpegAudioAndMetadata.ExtractSubtitles(inPath, current.tempFolder, current.outMode); diff --git a/Code/Media/FfmpegAudioAndMetadata.cs b/Code/Media/FfmpegAudioAndMetadata.cs index 8dd181a..f686198 100644 --- a/Code/Media/FfmpegAudioAndMetadata.cs +++ b/Code/Media/FfmpegAudioAndMetadata.cs @@ -185,6 +185,12 @@ namespace Flowframes.Media bool audioCompat = Utils.ContainerSupportsAllAudioFormats(Interpolate.current.outMode, GetAudioCodecs(interpVideo)); string audioArgs = audioCompat ? "" : Utils.GetAudioFallbackArgs(Interpolate.current.outMode); + if (!Config.GetBool("keepAudio")) + audioArgs = "-an"; + + if (!Config.GetBool("keepSubs")) + subArgs = "-sn"; + // TODO: Check if movflags faststart is needed here! if (QuickSettingsTab.trimEnabled) @@ -200,7 +206,7 @@ namespace Flowframes.Media IOUtils.TryDeleteIfExists(Path.Combine(tempFolder, otherStreamsName)); } - else // If trimming is disabled we can pull the streams directly from the input file + else // If trimming is disabled we can pull the streams directly from the input file { string args = $"-i {inName} -i {inputVideo.Wrap()} -map 0:v:0 -map 1:a:? -map 1:s:? -c copy {audioArgs} {subArgs} {outName}"; await RunFfmpeg(args, tempFolder, LogMode.Hidden);