diff --git a/Code/Main/Interpolate.cs b/Code/Main/Interpolate.cs index bc2d655..647c761 100644 --- a/Code/Main/Interpolate.cs +++ b/Code/Main/Interpolate.cs @@ -49,7 +49,7 @@ namespace Flowframes await GetFrames(); if (canceled) return; sw.Restart(); - await PostProcessFrames(); + await PostProcessFrames(false); } if (canceled) return; @@ -69,12 +69,12 @@ namespace Flowframes Program.mainForm.SetStatus("Done interpolating!"); } - public static async Task GetFrames () + public static async Task GetFrames (bool stepByStep = false) { current.RefreshAlpha(); - if (!current.inputIsFrames) // Input is video - extract frames first - await ExtractFrames(current.inPath, current.framesFolder, current.alpha); + if (!current.inputIsFrames) // Extract if input is video, import if image sequence + await ExtractFrames(current.inPath, current.framesFolder, current.alpha, !stepByStep); else await FfmpegExtract.ImportImages(current.inPath, current.framesFolder, current.alpha, await Utils.GetOutputResolution(current.inPath, true)); @@ -88,9 +88,9 @@ namespace Flowframes } } - public static async Task ExtractFrames(string inPath, string outPath, bool alpha, bool extractAudio = true) + public static async Task ExtractFrames(string inPath, string outPath, bool alpha, bool sceneDetect) { - if (Config.GetBool("scnDetect")) + if (sceneDetect && Config.GetBool("scnDetect")) { Program.mainForm.SetStatus("Extracting scenes from video..."); await FfmpegExtract.ExtractSceneChanges(inPath, Path.Combine(current.tempFolder, Paths.scenesDir), current.inFps); @@ -114,21 +114,19 @@ namespace Flowframes if(!Config.GetBool("allowConsecutiveSceneChanges", true)) Utils.FixConsecutiveSceneFrames(Path.Combine(current.tempFolder, Paths.scenesDir), current.framesFolder); - if (extractAudio) - { - if (canceled) return; - Program.mainForm.SetStatus("Extracting audio from video..."); - string audioFile = Path.Combine(current.tempFolder, "audio"); - if (audioFile != null && !File.Exists(audioFile)) - await FfmpegAudioAndMetadata.ExtractAudio(inPath, audioFile); - } + if (canceled) return; + Program.mainForm.SetStatus("Extracting audio from video..."); + string audioFile = Path.Combine(current.tempFolder, "audio"); + + if (audioFile != null && !File.Exists(audioFile)) + await FfmpegAudioAndMetadata.ExtractAudio(inPath, audioFile); if (canceled) return; Program.mainForm.SetStatus("Extracting subtitles from video..."); await FfmpegAudioAndMetadata.ExtractSubtitles(inPath, current.tempFolder, current.outMode); } - public static async Task PostProcessFrames (bool stepByStep = false) + public static async Task PostProcessFrames (bool stepByStep) { if (canceled) return; diff --git a/Code/Main/InterpolateSteps.cs b/Code/Main/InterpolateSteps.cs index 8d28cfb..cf06496 100644 --- a/Code/Main/InterpolateSteps.cs +++ b/Code/Main/InterpolateSteps.cs @@ -37,9 +37,7 @@ namespace Flowframes.Main } if (step.Contains("Extract Frames")) - { await ExtractFramesStep(); - } if (step.Contains("Run Interpolation")) await DoInterpolate(); @@ -79,7 +77,7 @@ namespace Flowframes.Main currentInputFrameCount = await InterpolateUtils.GetInputFrameCountAsync(current.inPath); AiProcess.filenameMap.Clear(); - await GetFrames(); + await GetFrames(true); } public static async Task DoInterpolate() diff --git a/Code/UI/UtilsTab.cs b/Code/UI/UtilsTab.cs index 7e6ffa7..ddbcd24 100644 --- a/Code/UI/UtilsTab.cs +++ b/Code/UI/UtilsTab.cs @@ -98,7 +98,7 @@ namespace Flowframes.UI await Task.Delay(10); framesPath = Path.ChangeExtension(inPath, null) + "-frames"; Directory.CreateDirectory(framesPath); - await Interpolate.ExtractFrames(inPath, framesPath, false); + await Interpolate.ExtractFrames(inPath, framesPath, false, false); } else {