public static async Task Run(string step)
        {
            Logger.Log($"[SBS] Running step '{step}'", true);
            canceled = false;
            Program.mainForm.SetWorking(true);

            if (current == null)
            {
                Logger.Log($"[SBS] Getting new current settings", true);
                current = Program.mainForm.GetCurrentSettings();
            }
            else
            {
                Logger.Log($"[SBS] Updating current settings", true);
                current = Program.mainForm.UpdateCurrentSettings(current);
            }

            current.RefreshAlpha();
            current.stepByStep = true;

            if (!InterpolateUtils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode))
            {
                return;                                                                                                                            // General input checks
            }
            if (!InterpolateUtils.CheckPathValid(current.inPath))
            {
                return;                                                             // Check if input path/file is valid
            }
            if (step.Contains("Extract Frames"))
            {
                await ExtractFramesStep();
            }

            if (step.Contains("Run Interpolation"))
            {
                await InterpolateStep();
            }

            if (step.Contains("Export"))
            {
                await CreateOutputVid();
            }

            if (step.Contains("Cleanup"))
            {
                await Reset();
            }

            Program.mainForm.SetWorking(false);
            Program.mainForm.SetStatus("Done running step.");
            Logger.Log("Done running this step.");
        }
Beispiel #2
0
        public static async Task Start()
        {
            if (!BatchProcessing.busy && Program.busy)
            {
                return;
            }
            canceled           = false;
            Program.initialRun = false;
            Program.mainForm.SetWorking(true);
            if (!Utils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode))
            {
                return;                                                                                                                 // General input checks
            }
            if (!Utils.CheckAiAvailable(current.ai, current.model))
            {
                return;                                                                // Check if selected AI pkg is installed
            }
            if (!AutoEncodeResume.resumeNextRun && !Utils.CheckDeleteOldTempFolder())
            {
                return;                                                                            // Try to delete temp folder if an old one exists
            }
            if (!Utils.CheckPathValid(current.inPath))
            {
                return;                                                  // Check if input path/file is valid
            }
            if (!(await Utils.CheckEncoderValid()))
            {
                return;                                               // Check NVENC compat
            }
            Utils.ShowWarnings(current.interpFactor, current.ai);
            currentInputFrameCount = await GetFrameCountCached.GetFrameCountAsync(current.inPath);

            current.stepByStep = false;
            Program.mainForm.SetStatus("Starting...");
            sw.Restart();

            if (!AutoEncodeResume.resumeNextRun)
            {
                await GetFrames();

                if (canceled)
                {
                    return;
                }
                await PostProcessFrames(false);
            }

            if (canceled)
            {
                return;
            }
            bool skip = await AutoEncodeResume.PrepareResumedRun();

            if (skip || canceled)
            {
                return;
            }
            //Task.Run(() => Utils.DeleteInterpolatedInputFrames());
            await RunAi(current.interpFolder, current.ai);

            if (canceled)
            {
                return;
            }
            Program.mainForm.SetProgress(100);

            if (!currentlyUsingAutoEnc)
            {
                await Export.ExportFrames(current.interpFolder, current.outPath, current.outMode, false);
            }

            if (!AutoEncodeResume.resumeNextRun && Config.GetBool(Config.Key.keepTempFolder))
            {
                await Task.Run(async() => { await FrameRename.Unrename(); });
            }

            await Done();
        }
Beispiel #3
0
        public static async Task Start()
        {
            if (!BatchProcessing.busy && Program.busy)
            {
                return;
            }
            canceled = false;
            Program.mainForm.SetWorking(true);
            if (!Utils.InputIsValid(current.inPath, current.outPath, current.outFps, current.interpFactor, current.outMode))
            {
                return;                                                                                                                  // General input checks
            }
            if (!Utils.CheckAiAvailable(current.ai))
            {
                return;                                                 // Check if selected AI pkg is installed
            }
            if (!ResumeUtils.resumeNextRun && !Utils.CheckDeleteOldTempFolder())
            {
                return;                                                                       // Try to delete temp folder if an old one exists
            }
            if (!Utils.CheckPathValid(current.inPath))
            {
                return;                                                  // Check if input path/file is valid
            }
            if (!(await Utils.CheckEncoderValid()))
            {
                return;                                               // Check NVENC compat
            }
            Utils.PathAsciiCheck(current.outPath, "output path");
            currentInputFrameCount = await Utils.GetInputFrameCountAsync(current.inPath);

            current.stepByStep = false;
            Program.mainForm.SetStatus("Starting...");

            if (!ResumeUtils.resumeNextRun)
            {
                await GetFrames();

                if (canceled)
                {
                    return;
                }
                sw.Restart();
                await PostProcessFrames(false);
            }

            if (canceled)
            {
                return;
            }
            await ResumeUtils.PrepareResumedRun();

            //Task.Run(() => Utils.DeleteInterpolatedInputFrames());
            await RunAi(current.interpFolder, current.ai);

            if (canceled)
            {
                return;
            }
            Program.mainForm.SetProgress(100);
            if (!currentlyUsingAutoEnc)
            {
                await CreateVideo.Export(current.interpFolder, current.outFilename, current.outMode, false);
            }
            await IOUtils.ReverseRenaming(current.framesFolder, AiProcess.filenameMap);   // Get timestamps back

            AiProcess.filenameMap.Clear();
            await Cleanup();

            Program.mainForm.SetWorking(false);
            Logger.Log("Total processing time: " + FormatUtils.Time(sw.Elapsed));
            sw.Stop();
            Program.mainForm.SetStatus("Done interpolating!");
        }