什么是初始化过滤器'drawtext'args…“;在c#进程类中使用ffmpeg时出错

本文关键字:进程 出错 ffmpeg 过滤器 初始化 drawtext args 什么 | 更新日期: 2023-09-27 18:16:01

我使用下面的代码来创建视频的分辨率,并在其上写入文本。

    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();

我遇到了这个问题(StandardError的一些字符串输出如下):

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

cmd中,process的相同参数值工作正常。我读到这个问题涉及如何在使用时使用引号ffmpeg中drawtexttext属性但是我找不到解决此问题的方案。有人能帮我吗?

还有人能帮我吗?这是臭虫吗?我在我的代码中使用了任何逃避:的解决方案,但无法解决这个问题。它找不到字体。我删除了drawtext的其他过滤器,以发现任何过滤器都没有错误,但仍然存在错误。

对于escape :, drawtext的

expansion=none属性对这种情况没有影响。

什么是初始化过滤器'drawtext'args…“;在c#进程类中使用ffmpeg时出错

在进程中将工作目录地址设置为proc.StartInfo.WorkingDirectory。完整的答案在这个链接中:
https://social.msdn.microsoft.com/forums/en us/13dc1101 f1d0 - 4655 b4af - 3 - f211927d5be/what - - -误差初始化滤波器drawtext - - arg游戏错误在ffmpeg - -使用- c - process?forum=netfxbcl