Skip to content

Commit

Permalink
Log FFmpeg Errors during audio encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Aug 24, 2022
1 parent f0dd4bd commit 383ca73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion NotEnoughAV1Encodes/Audio/EncodeAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ public void Encode(Queue.QueueElement queueElement, CancellationToken _token)
processAudio.Start();

StreamReader sr = processAudio.StandardError;
string stderr = "\n";
while (!sr.EndOfStream)
{
int processedFrames = Global.GetTotalTimeProcessed(sr.ReadLine(), queueElement);
string line = sr.ReadLine();
if (!line.Contains("time="))
stderr += line + "\n";
int processedFrames = Global.GetTotalTimeProcessed(line, queueElement);
if (processedFrames != 0)
{
queueElement.Progress = Convert.ToDouble(processedFrames);
Expand All @@ -57,6 +61,8 @@ public void Encode(Queue.QueueElement queueElement, CancellationToken _token)
else
{
Global.Logger("FATAL - EncodeAudio.Encode() => ExitCode: " + processAudio.ExitCode, queueElement.Output + ".log");
Global.Logger("==========================================================" + stderr, queueElement.Output + ".log");
Global.Logger("==========================================================", queueElement.Output + ".log");
}
}
else
Expand Down

0 comments on commit 383ca73

Please sign in to comment.