Integrated new stream transfer code with config options

This commit is contained in:
Julian Maier
2021-03-03 16:12:49 +01:00
parent 209844230e
commit 088cc4818e
3 changed files with 13 additions and 4 deletions

View File

@@ -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
{

View File

@@ -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);

View File

@@ -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);