示例#1
0
        public static async Task InitInput(TextBox outputTbox, TextBox inputTbox, TextBox fpsInTbox, bool start = false)
        {
            Program.mainForm.SetTab("interpolate");
            Program.mainForm.ResetInputInfo();
            string path = inputTbox.Text.Trim();

            GetFrameCountCached.Clear();
            GetMediaResolutionCached.Clear();

            if (Config.GetBool(Config.Key.clearLogOnInput))
            {
                Logger.ClearLogBox();
            }

            SetOutPath(outputTbox, inputTbox.Text.Trim().GetParentDir());

            Program.lastInputPath      = path;
            Program.lastInputPathIsSsd = OsUtils.DriveIsSSD(path);

            if (!Program.lastInputPathIsSsd)
            {
                Logger.Log("Your file seems to be on an HDD or USB device. It is recommended to interpolate videos on an SSD drive for best performance.");
            }

            Logger.Log("Loading metadata...");
            Program.mainForm.currInDuration    = FfmpegCommands.GetDuration(path);
            Program.mainForm.currInDurationCut = Program.mainForm.currInDuration;
            int frameCount = await GetFrameCountCached.GetFrameCountAsync(path);

            string   fpsStr = "Not Found";
            Fraction fps    = (await IoUtils.GetFpsFolderOrVideo(path));

            Program.mainForm.currInFpsDetected = fps;
            fpsInTbox.Text = fps.GetString();

            if (fps.GetFloat() > 0)
            {
                fpsStr = $"{fps} (~{fps.GetFloat()})";
            }

            Logger.Log($"Video FPS: {fpsStr} - Total Number Of Frames: {frameCount}", false, true);
            Program.mainForm.GetInputFpsTextbox().ReadOnly = (fps.GetFloat() > 0 && !Config.GetBool("allowCustomInputRate", false));
            Program.mainForm.currInFps    = fps;
            Program.mainForm.currInFrames = frameCount;
            Program.mainForm.UpdateInputInfo();
            CheckExistingFolder(path, outputTbox.Text.Trim());
            await Task.Delay(10);

            await PrintResolution(path);

            Dedupe.ClearCache();
            await Task.Delay(10);

            InterpolationProgress.SetPreviewImg(await GetThumbnail(path));

            if (AutoEncodeResume.resumeNextRun)
            {
                Logger.Log($"Incomplete interpolation detected. Flowframes will resume the interpolation.");
            }

            if (start)
            {
                Program.mainForm.runBtn_Click(null, null);
            }
        }