ffmpeg.exe转换视频不成功,有做过的给点指点吧
最近要做个在线转视频的功能,从网上弄了份代码,下面这段是转换代码,怎么都转不成功,运行框一闪就没了,文件夹里没有转换后的视频,哪位大侠做过,给看看吧
public string ChangeFilePhy(string fileName, string playFile, string imgFile)
{
//取得ffmpeg.exe的路径,路径配置在Web.Config中,如:<add key="ffmpeg" value="E:\51aspx\ffmpeg.exe" />
string ffmpeg = Server.MapPath(PublicMethod.ffmpegtool);
if ((!System.IO.File.Exists(ffmpeg)) || (!System.IO.File.Exists(fileName)))
{
return "";
}
//获得图片和(.flv)文件相对路径/最后存储到数据库的路径,如:/Web/User1/00001.jpg
string flv_file = System.IO.Path.ChangeExtension(playFile, ".flv");
//截图的尺寸大小,配置在Web.Config中,如:<add key="CatchFlvImgSize" value="240x180" />
string FlvImgSize = PublicMethod.sizeOfImg;
System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(ffmpeg);
FilestartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
FilestartInfo.Arguments = " -i " + fileName + " -ab 56 -ar 22050 -b 500 -r 15 -s " + widthOfFile + "x" + heightOfFile + " " + flv_file;
//ImgstartInfo.Arguments = " -i " + fileName + " -y -f image2 -t 0.05 -s " + FlvImgSize + " " + flv_img;
FilestartInfo.UseShellExecute = false;
FilestartInfo.CreateNoWindow = true;
try
{
//转换
System.Diagnostics.Process.Start(FilestartInfo);
//截图
CatchImg(fileName, imgFile);
}
catch
{
return "";
}
return "";
}
--------------------编程问答--------------------
看看这个
http://bbs.csdn.net/topics/380224646
--------------------编程问答--------------------
这个是c语言写的吧
--------------------编程问答--------------------
大家给点建议,帮着顶顶也行啊,帮顶有分
--------------------编程问答--------------------
fileName 最好外边加上引号,可能是文件路径中有空格,这样一个文件路径就被识别为两个参数了
补充:.NET技术 , ASP.NET