c# - 什么是 "Error initializing filter ' drawtext' with args..."在 c# 进程类中使用 ffmpeg 时出现错误?

标签 c# process ffmpeg drawtext

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

    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

命令 process 的相同参数值可以正常工作。
我读到这个问题与如何使用 相关。引号 在使用
文字 的属性(property)绘制文本 在 ffmpeg. 但我找不到任何
解决此问题的解决方案。
谁能帮我?

任何人都可以帮助我吗?这是一个错误吗?
我使用了任何解决方案来逃离 :在我的代码中,但无法解决这个问题。
它找不到字体。我删除了drawtext的其他过滤器,以发现任何过滤器都没有出错,但仍然存在错误。
expansion=none drawtext 的属性不会影响这种情况,用于转义 : .

最佳答案

它适用于将工作目录地址值设置为 proc.StartInfo.WorkingDirectory在 process.and 完整的答案在这个链接中:
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

关于c# - 什么是 "Error initializing filter ' drawtext' with args..."在 c# 进程类中使用 ffmpeg 时出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40398506/

相关文章:

c# - 是什么过早地破坏了我的 Process.StartInfo.OutputDataReceived 回调?

macos - 无法使用 gifify 将 mp4 转换为 gif

c# - 使用 C# 验证小费计算器中的数据

c# - 在 List<int> 中查找(并替换)相邻的相等/相似元素

c# - 设置服务器名称指示 (SNI) 取消证书绑定(bind)

Javascript 同步和异步进程优先级

c# - 创建自定义控件的最佳 WPF 面板

windows - 如何运行具有特定名称的空后台进程?

ffmpeg - ffmpeg 可以处理来自 FMS 的 rtmp 流吗?

Python subprocess.Popen + ffmpeg 中断终端输入