62,046
社区成员
发帖
与我相关
我的任务
分享
//fileName flv文件地址
//imgFile 输出的图片地址
public string CatchImg(string fileName,string imgFile)
{
//
string ffmpeg = VideoDecoder.ffMpeg; //ffmpeg执行文件的路径
//
string flv_img =imgFile+".jpg";
//
string FlvImgSize = VideoDecoder.sizeOfImg;//生成的图片分辨率 240x180
//
System.Diagnostics.ProcessStartInfo ImgstartInfo = new System.Diagnostics.ProcessStartInfo(ffmpeg);
ImgstartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
//
ImgstartInfo.Arguments = " -i " + fileName + " -y -f image2 -ss 2 -vframes 1 -s " + FlvImgSize + " " + flv_img;
try
{
System.Diagnostics.Process.Start(ImgstartInfo);
}
catch
{
return "";
}
//
if (System.IO.File.Exists(flv_img))
{
return flv_img;
}
return "";
}