Cancel if no frames were output (avoid "waiting for encoding" forever)

This commit is contained in:
N00MKRAD
2021-04-30 10:36:44 +02:00
parent 699515a546
commit e61d510cf3

View File

@@ -67,7 +67,8 @@ namespace Flowframes
if (Interpolate.canceled) return; if (Interpolate.canceled) return;
Program.mainForm.SetProgress(100); Program.mainForm.SetProgress(100);
AiProcessSuspend.SetRunning(false); AiProcessSuspend.SetRunning(false);
InterpolationProgress.UpdateInterpProgress(IOUtils.GetAmountOfFiles(Interpolate.current.interpFolder, false, "*" + Interpolate.current.interpExt), InterpolationProgress.targetFrames); int interpolatedFrames = IOUtils.GetAmountOfFiles(Interpolate.current.interpFolder, false, "*" + Interpolate.current.interpExt);
InterpolationProgress.UpdateInterpProgress(interpolatedFrames, InterpolationProgress.targetFrames);
string logStr = $"Done running {aiName} - Interpolation took {FormatUtils.Time(processTime.Elapsed)}. Peak Output FPS: {InterpolationProgress.peakFpsOut.ToString("0.00")}"; string logStr = $"Done running {aiName} - Interpolation took {FormatUtils.Time(processTime.Elapsed)}. Peak Output FPS: {InterpolationProgress.peakFpsOut.ToString("0.00")}";
if (Interpolate.currentlyUsingAutoEnc && AutoEncode.HasWorkToDo()) if (Interpolate.currentlyUsingAutoEnc && AutoEncode.HasWorkToDo())
@@ -79,6 +80,13 @@ namespace Flowframes
Logger.Log(logStr); Logger.Log(logStr);
processTime.Stop(); processTime.Stop();
if(interpolatedFrames < 3)
{
string amount = interpolatedFrames > 0 ? $"Only {interpolatedFrames}" : "No";
Interpolate.Cancel($"Interpolation failed - {amount} interpolated frames were created.");
return;
}
while (Interpolate.currentlyUsingAutoEnc && Program.busy) while (Interpolate.currentlyUsingAutoEnc && Program.busy)
{ {
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited && AvProcess.lastTask == AvProcess.TaskType.Encode) if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited && AvProcess.lastTask == AvProcess.TaskType.Encode)