Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Process.Start() slower than console

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?

like image 604
gu471 Avatar asked May 16 '13 12:05

gu471


1 Answers

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.

like image 191
Parimal Raj Avatar answered Oct 12 '22 11:10

Parimal Raj