mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-25 04:39:25 +01:00
Fix AutoEnc ffmpeg log sometimes stopping & beautify log line
This commit is contained in:
@@ -109,12 +109,8 @@ namespace Flowframes
|
||||
|
||||
bool replaceLastLine = currentLogMode == LogMode.OnlyLastLine;
|
||||
|
||||
if (line.StartsWith("frame=")) // Format stats
|
||||
{
|
||||
line = line.Remove("q=-0.0").Remove("q=-1.0").Remove("size=N/A").Remove("bitrate=N/A").Replace("frame=", "Frame: ")
|
||||
.Replace("fps=", "FPS: ").Replace("q=", "QP: ").Replace("time=", "Time: ").Replace("speed=", "Relative Speed: ")
|
||||
.Replace("bitrate=", "Bitrate: ").Replace("Lsize=", "Size: ").Replace("size=", "Size: ").TrimWhitespaces();
|
||||
}
|
||||
if (line.StartsWith("frame="))
|
||||
line = FormatUtils.BeautifyFfmpegStats(line);
|
||||
|
||||
Logger.Log(line, hidden, replaceLastLine, "ffmpeg");
|
||||
|
||||
|
||||
@@ -171,5 +171,12 @@ namespace Flowframes.MiscUtils
|
||||
return new System.Drawing.Size();
|
||||
}
|
||||
}
|
||||
|
||||
public static string BeautifyFfmpegStats (string line)
|
||||
{
|
||||
return line.Remove("q=-0.0").Remove("q=-1.0").Remove("size=N/A").Remove("bitrate=N/A").Replace("frame=", "Frame: ")
|
||||
.Replace("fps=", "FPS: ").Replace("q=", "QP: ").Replace("time=", "Time: ").Replace("speed=", "Relative Speed: ")
|
||||
.Replace("bitrate=", "Bitrate: ").Replace("Lsize=", "Size: ").Replace("size=", "Size: ").TrimWhitespaces();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ namespace Flowframes
|
||||
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited && AvProcess.lastTask == AvProcess.TaskType.Encode)
|
||||
{
|
||||
string lastLine = AvProcess.lastOutputFfmpeg.SplitIntoLines().Last();
|
||||
Logger.Log(lastLine.Trim().TrimWhitespaces(), false, Logger.GetLastLine().Contains("frame"));
|
||||
Logger.Log(FormatUtils.BeautifyFfmpegStats(lastLine), false, Logger.GetLastLine().ToLower().Contains("frame"));
|
||||
}
|
||||
|
||||
if (AvProcess.timeSinceLastOutput.IsRunning && AvProcess.timeSinceLastOutput.ElapsedMilliseconds > 2500)
|
||||
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
|
||||
break;
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
Reference in New Issue
Block a user