private void SplicingProcessOutputDataReceived(object sendingProcess, DataReceivedEventArgs outLine)
{
if (!String.IsNullOrEmpty(outLine.Data))
{
// Add the text to the collected output.
//SplicingProcessOutput += outLine.Data + Environment.NewLine;
// frame= 212 fps=6.1 q=0.0 size= 77812kB time=00:00:03.53 bitrate=180225.2kbits
var fpsIndex = outLine.Data.IndexOf(" fps=", StringComparison.Ordinal);
if (fpsIndex > 0)
{
var beforeFps = outLine.Data.Substring(0, fpsIndex);
var frameIndex = beforeFps.LastIndexOf(" ", StringComparison.Ordinal);
if (frameIndex <= 0)
frameIndex = beforeFps.LastIndexOf("=", StringComparison.Ordinal);
if (frameIndex > 0)
{
var frameAsString = beforeFps.Substring(frameIndex + 1);
int processedFrames;
if (Int32.TryParse(frameAsString, out processedFrames))
{
var newProgress = (int)(100.0 * processedFrames / TotalProgressUnits);
if (newProgress > 3) // so progress doesn't go down, since SpliceVideo already puts this to 3
ReportProgress(newProgress);
}
}
}
if (!HideOutputFile)
Logger.Info("ffmpeg output: " + outLine.Data);
FfmpegOutput += outLine.Data + Environment.NewLine;
}
}