parsa parsa - 27 days ago 12
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] +
".mp4";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;

proc.Start();
proc.WaitForExit();
string sdsd = proc.StandardError.ReadToEnd();
proc.Close();


I faced with this problem(some string output of
StandardError
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
'fontfile=/OtherProjects/ConvertProj/ffmpeg/OpenSans-
Regular.ttf:text=parsa'\r\nError opening
filters!\r\n


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.

expansion=none
property of drawtext doesn't influence on this case, for escape
:
.

Answer

It works with set working directory address value to proc.StartInfo.WorkingDirectory at process.and full answer is in this link:
https://social.msdn.microsoft.com/Forums/en-US/13dc1101-f1d0-4655-b4af-3f211927d5be/what-is-the-error-initializing-filter-drawtext-with-args-error-in-using-of-ffmpeg-at-c-process?forum=netfxbcl

Comments