6

I want to make a parser for ffmpeg output. But when running ffmpeg just only via

strCmdText = "-y -i \"" + path + "\"";
strCmdText += " -async 1 -vf yadif -c:v libx264 -b:v 1024k -r 30 -bf 1 -an nul.avi";
Process.Start(new ProcessStartInfo("lib\\ffmpeg.exe", strCmdText));

it's 2/3 slower than starting it in a batch:

set FFMPEG="ffmpeg\ffmpeg.exe"
%FFMPEG% -y -i %1 -async 1 -vf yadif -c:v libx264 -b:v 1024k -r 30 -bf 1 -an -pass 1 nul.avi

Running in C# it has a fps-rate of 130 (CPU: 100%), but running it with the batch it has 400 fps (CPU 75%).

In both ways the RAM usages and are same, #Handels and #Threads too. Setting the process priority to High/Live won't fix this nor running the process in a separate thread.

Is this normal, or can it be fixed?

gu471
  • 173
  • 12
  • Did you (or someone else) define a processor affinity for your starting process (or any of it's parent processes)? Use Process Monitor to find out if this is the case. Running only at 75% could indicate that the process only uses 3/4 of the available cores. – Dirk Vollmar May 16 '13 at 12:39
  • 3
    You seem to have different arguments passed to executable located in different places. Can you double check the arguments are exactly the same and that you use exactly the same executable? – oleksii May 16 '13 at 12:40

1 Answers1

4

when you are starting the application using Process.Start, you are missing a -pass 1 switch in the command prompt, may be that is affecting the output.

AFAIK, the speed & the output of the application started via Process.Start is same as it would have started under normal circumstances.

There can be 1% or 2% change in performance, but that is mostly due to cpu, process affinity and things related to hardward.

Parimal Raj
  • 20,189
  • 9
  • 73
  • 110