parsa parsa - 1 year ago 84
C# Question

What is the "Error initializing filter 'drawtext' with args..." error in using of ffmpeg at c# process class?

I used this below code for create a resolution of a video and write text on it.

var proc = new System.Diagnostics.Process();
strin OrginalResolution="nhd";
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = ffmpegPath;
proc.StartInfo.Arguments = "-i \"" + fileIn +
"\" -f mp4 -s " + OrginalResolution + " -vf drawtext=fontfile=/OtherProjects/ConvertProj/ff‌​mpeg/OpenSans-Reg‌​ular.ttf:text=Parsa" \"" + fileOut.Split('.')[0] +
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;

string sdsd = proc.StandardError.ReadToEnd();

I faced with this problem(some string output of
is in below):

Fontconfig error: Cannot load default config file\r\n[Parsed_drawtext_0
@0000000002fd8c20] Cannot find a valid font for the family
Sans\r\n[AVFilterGraph @ 0000000000511660] Error initializing
filter'drawtext' with args
Regular.ttf:text=parsa'\r\nError opening

In cmd the same argument value of process works fine.
I read that this issue related to how to using quotation mark at using
of text property of drawtext in ffmpeg.but I can't find any
solution for solving this issue.

Can anyone help me?

Can anyone help me still?Is this a bug?
I used any solutions for escape from
in my code,but can't solve this problem.
It can't find font.I delete other filters of drawtext to findout that any of filters don't mistake, but still error exists yet.

property of drawtext doesn't influence on this case, for escape

Answer Source

It works with set working directory address value to proc.StartInfo.WorkingDirectory at process.and full answer is in this link: