【发布时间】:2019-12-19 00:07:13
【问题描述】:
我正在尝试从视频文件中获取动画 gif。我无法从以下代码创建 gif。谁能帮我解决这个问题。
Process ffmpeg; // creating process
string video;
string thumb;
// string text = System.IO.File.ReadAllText(@"C:\xampp\htdocs\h\myText.txt");
video = Page.MapPath("") + "\\o.avi";
thumb = Page.MapPath("") + "\\output\\o.gif"; // thumb name with path !
ffmpeg = new Process();
int num = 3;
int secpos = 1;
// ffmpeg.StartInfo.Arguments = "ffmpeg -i o.avi -vf scale=320:-1,format=rgb8,format=rgb24 -t 10 -r 10 output.gif"; // arguments !
ffmpeg.StartInfo.Arguments = " -i \"" + video + "\" -s 108*80 -ss " + secpos + " -t " + num + "\" -vf scale=320:-1,format=rgb8,format=rgb24 \"" + thumb + "\"";
ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg//ffmpeg.exe");
ffmpeg.Start(); // start !
我认为 ffmpeg.StartInfo.Arguments 有错误。
【问题讨论】:
-
最好更具体地说明什么不起作用。你有例外还是什么?
-
出现如下异常:t:3 -vf scale=320:-1,format=rgb8,format=rgb24 的持续时间规范无效
标签: c# ffmpeg sharpffmpeg