如何解决ffmpeg fontfile在命令提示符下工作正常,但通过C#代码调用时不起作用
ffmpeg.exe -y -i "C:\TEST.mp4" -frames:v 1 -filter_complex "drawtext=fontfile='/Windows/Fonts/GOTHIC.TTF': text='TEST': fontcolor=Red: fontsize = 100: x=(w/100)*5: y=(h/100)*87: " D:\ffoutput.png
从命令提示符处执行此命令时,它可以正常工作。但是,当使用C#代码执行相同的命令时,它将不起作用。虽然一切正常,而不是fontfile。
外汇:文本的颜色会发生变化, x 和 y 会发生变化,字体大小会发生变化,但 fontstyle(fontfile)不会更改。
函数调用Execute("ffmpeg.exe","-y -i "C:\TEST.mp4" -frames:v 1 -filter_complex "drawtext=fontfile='/Windows/Fonts/GOTHIC.TTF': text='TEST': fontcolor=Red: fontsize = 100: x=(w/100)*5: y=(h/100)*87: " D:\ffoutput.png")
private string Execute(string exePath,string parameters)
{
/*C# code which does not work*/
string result = String.Empty;
using (Process p = new Process())
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = exePath;
p.StartInfo.Arguments = parameters;
p.StartInfo.Verb = "runas";
p.Start();
p.WaitForExit();
result = p.StandardOutput.ReadToEnd();
}
return result;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。