mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-23 19:59:31 +01:00
Print ffmpeg log while waiting for autoenc to finish
This commit is contained in:
@@ -51,16 +51,14 @@ namespace Flowframes
|
|||||||
if (outLine == null || outLine.Data == null)
|
if (outLine == null || outLine.Data == null)
|
||||||
return;
|
return;
|
||||||
string line = outLine.Data;
|
string line = outLine.Data;
|
||||||
lastOutputFfmpeg = lastOutputFfmpeg + line + "\n";
|
lastOutputFfmpeg = lastOutputFfmpeg + "\n" + line;
|
||||||
bool hidden = currentLogMode == LogMode.Hidden;
|
bool hidden = currentLogMode == LogMode.Hidden;
|
||||||
bool replaceLastLine = currentLogMode == LogMode.OnlyLastLine;
|
bool replaceLastLine = currentLogMode == LogMode.OnlyLastLine;
|
||||||
string trimmedLine = line.Remove("q=-0.0").Remove("size=N/A").Remove("bitrate=N/A").TrimWhitespaces();
|
string trimmedLine = line.Remove("q=-0.0").Remove("size=N/A").Remove("bitrate=N/A").TrimWhitespaces();
|
||||||
Logger.Log(trimmedLine, hidden, replaceLastLine, "ffmpeg");
|
Logger.Log(trimmedLine, hidden, replaceLastLine, "ffmpeg");
|
||||||
|
|
||||||
if(line.Contains("Could not open file"))
|
if(line.Contains("Could not open file"))
|
||||||
{
|
Interpolate.Cancel($"FFmpeg Error: {line}");
|
||||||
Interpolate.Cancel("Failed to write frames - Make sure the folder is not restricted!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FfmpegOutputHandlerSilent (object sendingProcess, DataReceivedEventArgs outLine)
|
static void FfmpegOutputHandlerSilent (object sendingProcess, DataReceivedEventArgs outLine)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Flowframes
|
|||||||
|
|
||||||
public static async Task ConcatVideos(string concatFile, string outPath, int looptimes = -1)
|
public static async Task ConcatVideos(string concatFile, string outPath, int looptimes = -1)
|
||||||
{
|
{
|
||||||
Logger.Log($"Merging videos...");
|
Logger.Log($"Merging videos...", false, Logger.GetLastLine().Contains("frame"));
|
||||||
string loopStr = (looptimes > 0) ? $"-stream_loop {looptimes}" : "";
|
string loopStr = (looptimes > 0) ? $"-stream_loop {looptimes}" : "";
|
||||||
string vfrFilename = Path.GetFileName(concatFile);
|
string vfrFilename = Path.GetFileName(concatFile);
|
||||||
string args = $" {loopStr} -vsync 1 -f concat -i {vfrFilename} -c copy -pix_fmt yuv420p -movflags +faststart {outPath.Wrap()}";
|
string args = $" {loopStr} -vsync 1 -f concat -i {vfrFilename} -c copy -pix_fmt yuv420p -movflags +faststart {outPath.Wrap()}";
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ namespace Flowframes
|
|||||||
public void SetWorking(bool state, bool allowCancel = true)
|
public void SetWorking(bool state, bool allowCancel = true)
|
||||||
{
|
{
|
||||||
Logger.Log($"SetWorking({state})", true);
|
Logger.Log($"SetWorking({state})", true);
|
||||||
|
SetProgress(-1);
|
||||||
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn, installerBtn };
|
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn, installerBtn };
|
||||||
Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector };
|
Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector };
|
||||||
progressCircle.Visible = state;
|
progressCircle.Visible = state;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace Flowframes.IO
|
|||||||
// Video Export
|
// Video Export
|
||||||
if (key == "h264Crf") return WriteDefault(key, "20");
|
if (key == "h264Crf") return WriteDefault(key, "20");
|
||||||
if (key == "h265Crf") return WriteDefault(key, "24");
|
if (key == "h265Crf") return WriteDefault(key, "24");
|
||||||
if (key == "vp9Crf") return WriteDefault(key, "28");
|
if (key == "vp9Crf") return WriteDefault(key, "32");
|
||||||
if (key == "proResProfile") return WriteDefault(key, "2");
|
if (key == "proResProfile") return WriteDefault(key, "2");
|
||||||
if (key == "aviCodec") return WriteDefault(key, "ffv1");
|
if (key == "aviCodec") return WriteDefault(key, "ffv1");
|
||||||
if (key == "aviColors") return WriteDefault(key, "yuv420p");
|
if (key == "aviColors") return WriteDefault(key, "yuv420p");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Flowframes
|
|||||||
|
|
||||||
public static void Log(string s, bool hidden = false, bool replaceLastLine = false, string filename = "")
|
public static void Log(string s, bool hidden = false, bool replaceLastLine = false, string filename = "")
|
||||||
{
|
{
|
||||||
if (s == null)
|
if (string.IsNullOrWhiteSpace(s))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Console.WriteLine(s);
|
Console.WriteLine(s);
|
||||||
@@ -97,5 +97,10 @@ namespace Flowframes
|
|||||||
string[] lines = textbox.Text.SplitIntoLines();
|
string[] lines = textbox.Text.SplitIntoLines();
|
||||||
return lines.Last();
|
return lines.Last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RemoveLastLine ()
|
||||||
|
{
|
||||||
|
textbox.Text = textbox.Text.Remove(textbox.Text.LastIndexOf(Environment.NewLine));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ namespace Flowframes.Main
|
|||||||
|
|
||||||
bool discardThisFrame = (sceneDetection && (i + 2) < frameFiles.Length && sceneFrames.Contains(Path.GetFileNameWithoutExtension(frameFiles[i + 1].Name))); // i+2 is in scene detection folder, means i+1 is ugly interp frame
|
bool discardThisFrame = (sceneDetection && (i + 2) < frameFiles.Length && sceneFrames.Contains(Path.GetFileNameWithoutExtension(frameFiles[i + 1].Name))); // i+2 is in scene detection folder, means i+1 is ugly interp frame
|
||||||
|
|
||||||
// TODO: Check if this is needed
|
|
||||||
// If loop is enabled, account for the extra frame added to the end for loop continuity
|
// If loop is enabled, account for the extra frame added to the end for loop continuity
|
||||||
if (loopEnabled && i == (frameFiles.Length - 2))
|
if (loopEnabled && i == (frameFiles.Length - 2))
|
||||||
interpFramesAmount = interpFramesAmount * 2;
|
interpFramesAmount = interpFramesAmount * 2;
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ namespace Flowframes.Main
|
|||||||
string[] frames = IOUtils.GetFilesSorted(outdir, $"*.{GetOutExt()}");
|
string[] frames = IOUtils.GetFilesSorted(outdir, $"*.{GetOutExt()}");
|
||||||
if (frames.Length > 1)
|
if (frames.Length > 1)
|
||||||
UpdateInterpProgress(frames.Length, targetFrames, frames[frames.Length - 1]);
|
UpdateInterpProgress(frames.Length, targetFrames, frames[frames.Length - 1]);
|
||||||
|
if (frames.Length >= targetFrames)
|
||||||
|
break;
|
||||||
await Task.Delay(GetProgressWaitTime(frames.Length));
|
await Task.Delay(GetProgressWaitTime(frames.Length));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -56,7 +58,6 @@ namespace Flowframes.Main
|
|||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Program.mainForm.SetProgress(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateInterpProgress(int frames, int target, string latestFramePath = "")
|
public static void UpdateInterpProgress(int frames, int target, string latestFramePath = "")
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Flowframes
|
|||||||
hasShownError = false;
|
hasShownError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AiFinished (string aiName)
|
static async Task AiFinished (string aiName)
|
||||||
{
|
{
|
||||||
Program.mainForm.SetProgress(100);
|
Program.mainForm.SetProgress(100);
|
||||||
InterpolateUtils.UpdateInterpProgress(IOUtils.GetAmountOfFiles(Interpolate.current.interpFolder, false, "*.png"), InterpolateUtils.targetFrames);
|
InterpolateUtils.UpdateInterpProgress(IOUtils.GetAmountOfFiles(Interpolate.current.interpFolder, false, "*.png"), InterpolateUtils.targetFrames);
|
||||||
@@ -49,6 +49,12 @@ namespace Flowframes
|
|||||||
logStr += " - Waiting for encoding to finish...";
|
logStr += " - Waiting for encoding to finish...";
|
||||||
Logger.Log(logStr);
|
Logger.Log(logStr);
|
||||||
processTime.Stop();
|
processTime.Stop();
|
||||||
|
while (AvProcess.lastProcess != null && !AvProcess.lastProcess.HasExited)
|
||||||
|
{
|
||||||
|
string lastLine = AvProcess.lastOutputFfmpeg.SplitIntoLines().Last();
|
||||||
|
Logger.Log(lastLine.Trim(), false, Logger.GetLastLine().Contains("frame"));
|
||||||
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task RunDainNcnn(string framesPath, string outPath, int targetFrames, int tilesize)
|
public static async Task RunDainNcnn(string framesPath, string outPath, int targetFrames, int tilesize)
|
||||||
|
|||||||
Reference in New Issue
Block a user