Hacer el curso de las necesidades del proyecto para obtener a cubrir la demanda en el momento de fotograma de vídeo Carga de vídeo puede ser bombeado a través de este archivo exe ffmpeg video para subir. código específico de la siguiente manera:
string videoPath = Request.Form["videoPath"];
string uploadPath = AppSettingUtil.AppSettings["UploadFilePath"];
string videoFilePath = Server.MapPath("~/" + uploadPath + videoPath);
string ffmpegPath = Server.MapPath(AppSettingUtil.AppSettings["ffmpeg"]);
if (!File.Exists(ffmpegPath)) return new AjaxResult("ffmpeg不存在");
string imagePath = DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.Ticks + ".png";
string imageSavePath = Server.MapPath("~/" + uploadPath + "" + imagePath);
string cmd = string.Format("-i {0} -ss 00:00:01 -vframes 1 {1}", videoFilePath, imageSavePath);
ProcessStartInfo startInfo = new ProcessStartInfo(ffmpegPath)
{
WindowStyle = ProcessWindowStyle.Hidden,
Arguments = cmd
};
try
{
Process proc = Process.Start(startInfo);
if (proc != null) proc.WaitForExit();
}
catch (Exception ex)
{
return new AjaxResult(ex.Message);
}
if (File.Exists(imageSavePath))
return new AjaxResult
{
IsSuccess = true,
Data = imagePath
};
return new AjaxResult("视频截图失败");
dirección de referencia
ffmpeg Descargar
Crear una imagen en miniatura de cada X segundos el video - FFmpeg