async Task RefreshInputRes() { if (_inputResolution.IsEmpty) { _inputResolution = await GetMediaResolutionCached.GetSizeAsync(inPath); } }
static async Task PrintResolution(string path) { Size res = new Size(); if (path == Interpolate.current?.inPath) { res = Interpolate.current.InputResolution; } else { res = await GetMediaResolutionCached.GetSizeAsync(path); } if (res.Width > 1 && res.Height > 1) { Logger.Log($"Input Resolution: {res.Width}x{res.Height}"); } Program.mainForm.currInRes = res; Program.mainForm.UpdateInputInfo(); }
public static async Task <Size> GetOutputResolution(string inputPath, bool print, bool returnZeroIfUnchanged = false) { Size resolution = await GetMediaResolutionCached.GetSizeAsync(inputPath); return(GetOutputResolution(resolution, print, returnZeroIfUnchanged)); }
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); } }