public string ChangeFileVir(string fileName,String imgFile,string Timespan)
{
string ffmpeg = Server.MapPath("~/Test/ffmpeg.exe");
if ((!System.IO.File.Exists(ffmpeg)) || (!System.IO.File.Exists(fileName)))
{
return "";
}
string flv_img = System.IO.Path.ChangeExtension(Server.MapPath(imgFile), ".jpg");
string FlvImgSize = "240*180";
System.Diagnostics.ProcessStartInfo ImgstartInfo = new System.Diagnostics.ProcessStartInfo(ffmpeg);
ImgstartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
ImgstartInfo.Arguments = " -i " + fileName + " -y -f image2 -ss "+Timespan+" -t 0.999 -s " + FlvImgSize + " " + flv_img;
try
{
System.Diagnostics.Process.Start(ImgstartInfo);
}
catch
{
return "";
}
System.Threading.Thread.Sleep(8000); //因为保存的原因,延时一定的时间后再查询图片是否存在,时间可设
if (System.IO.File.Exists(flv_img))
{
return imgFile;
}
return "";
}