日期:2014-05-17 浏览次数:21106 次
public void GetThumb(string videoFileName)
{
string thumbImg = @"E:\ct_file\program\movie\images\" + this.GetFileName(videoFileName).Replace("''","'") + ".jpg"; // 图片保存路径
if (File.Exists(thumbImg))
{
execCmd(string.Format(@"update tb_movie set file_img='{0}' where file_name='{1}' and file_folder='{2}'", thumbImg.Replace("'", "''"), this.GetFileName(videoFileName), this.GetFileFolder(videoFileName)));
return;
}
Process ffmpeg = new Process();
ffmpeg.StartInfo.Arguments = " -i \"" + videoFileName + "\" -s 240*215 -ss 10 -vframes 1 -f image2 -vcodec mjpeg \"" + thumbImg + "\""; // arguments !
ffmpeg.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "ffmpeg.exe";
ffmpeg.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ffmpeg.Start(); // start !
ffmpeg.WaitForExit();
ffmpeg.Close();
ffmpeg.Dispose();
}