使用ffmpeg进行视频封面截取

项目需求:用户上传视频格式的文件,需要转为指定编码的MP4格式(为了适应在线播放),并且截取视频的第一帧作为封面图片(用于展示)

实现:

1.下载ffmpeg.exe

地址:http://ffmpeg.org/

2.主要代码

System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(“ffmpeg.exe的路径”);
FilestartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
FilestartInfo.Arguments = " 参数  -i -s等";//设置参数、截图输出路径等
System.Diagnostics.Process ps
= new System.Diagnostics.Process(); ps.StartInfo = FilestartInfo; ps.Start();

...
Dispose();
原文地址:https://www.cnblogs.com/talentzemin/p/10599933.html