原文:http://xkde.com/ComContent-149-9951.aspx
ffmpeg文件大家可到官网下载了,注意ffmpeg的参数,和之间的空格!
使用时也要注意,文件有读写权限和.net调用ffmpeg的权限,自己没服务器,建议就不要使用了.
以下是引用片段:
if (MoveFileName.Substring(MoveFileName.LastIndexOf(".")) == ".wmv" || MoveFileName.Substring(MoveFileName.LastIndexOf(".")) == ".3gp")
{
//程序截图
string ffmpeg = Server.MapPath("ffmpeg/ffmpeg.exe");
string move = Server.MapPath("upfile/" + RMoveFileName);
pic = Myfunction.MakeNum(5) + Myfunction.MakeFileName() + ".jpg";
Process p = new Process();
p.StartInfo.FileName = ffmpeg;
p.StartInfo.Arguments = "-i " + move + " -y -f image2 -t 0.001 -s 120*120 " + Server.MapPath("upfile/img/" + pic);
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
try
{
p.Start();
p.Dispose();
p.Close();
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
}

- 评论:(0)
发表评论 点击这里获取该日志的TrackBack引用地址