Fixed invalid chunk deletion & freeze after merging chunks after resume

This commit is contained in:
n00mkrad
2021-09-30 00:33:19 +02:00
parent 3caa1ec6c2
commit ae34cfe5f2
4 changed files with 7 additions and 6 deletions

View File

@@ -153,7 +153,7 @@ namespace Flowframes.Main
if(!imgSeq && Config.GetInt(Config.Key.autoEncBackupMode) > 0)
{
if (aiRunning && (currentMuxTask == null || (currentMuxTask != null && currentMuxTask.IsCompleted)))
currentMuxTask = Task.Run(() => Export.ChunksToVideos(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath, true));
currentMuxTask = Task.Run(() => Export.ChunksToVideo(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath, true));
else
Logger.Log($"[AE] Skipping backup because {(!aiRunning ? "this is the final chunk" : "previous mux task has not finished yet")}!", true, false, "ffmpeg");
}
@@ -178,7 +178,7 @@ namespace Flowframes.Main
if (imgSeq)
return;
await Export.ChunksToVideos(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath);
await Export.ChunksToVideo(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath);
}
catch (Exception e)
{

View File

@@ -94,7 +94,7 @@ namespace Flowframes.Main
string videoChunksFolder = Path.Combine(I.current.tempFolder, Paths.chunksDir);
FileInfo[] invalidChunks = IoUtils.GetFileInfosSorted(videoChunksFolder, false, "????.*").Skip(encodedChunks).ToArray();
FileInfo[] invalidChunks = IoUtils.GetFileInfosSorted(videoChunksFolder, true, "????.*").Skip(encodedChunks).ToArray();
foreach (FileInfo chunk in invalidChunks)
chunk.Delete();
@@ -108,7 +108,7 @@ namespace Flowframes.Main
if(IoUtils.GetAmountOfFiles(videoChunksFolder, true, "*.*") > 0)
{
Logger.Log($"No more frames left to interpolate - Merging existing video chunks instead.");
await Export.ChunksToVideos(I.current.tempFolder, videoChunksFolder, I.current.outPath);
await Export.ChunksToVideo(I.current.tempFolder, videoChunksFolder, I.current.outPath);
await I.Done();
}
else

View File

@@ -189,7 +189,7 @@ namespace Flowframes.Main
}
}
public static async Task ChunksToVideos(string tempFolder, string chunksFolder, string baseOutPath, bool isBackup = false)
public static async Task ChunksToVideo(string tempFolder, string chunksFolder, string baseOutPath, bool isBackup = false)
{
if (IoUtils.GetAmountOfFiles(chunksFolder, true, "*" + FfmpegUtils.GetExt(I.current.outMode)) < 1)
{

View File

@@ -65,7 +65,7 @@ namespace Flowframes
if(!currentlyUsingAutoEnc)
await Export.ExportFrames(current.interpFolder, current.outPath, current.outMode, false);
if (Config.GetBool(Config.Key.keepTempFolder))
if (!AutoEncodeResume.resumeNextRun && Config.GetBool(Config.Key.keepTempFolder))
await Task.Run(async () => { await FrameRename.Unrename(); });
await Done();
@@ -74,6 +74,7 @@ namespace Flowframes
public static async Task Done ()
{
await Cleanup();
Logger.Log($"after cleanup in done", true);
Program.mainForm.SetWorking(false);
Logger.Log("Total processing time: " + FormatUtils.Time(sw.Elapsed));
sw.Stop();