ffmpeg

=============================================
1.安装
=============================================
mac:
------------------------------------------------------------
brew install ffmpeg
------------------------------------------------------------
linux:
------------------------------------------------------------
yum -y install ffmpeg
在/etc/profile末尾加上:
export FFMPEG_HOME=/usr/local/ffmpeg
export PATH=$FFMPEG_HOME/bin:$PATH
编译:
source /etc/profile
=============================================
2.命令:
=============================================
1.提取所有图片
-r 指定抽取的帧率,即从视频中每秒钟抽取图片的数量。1代表每秒抽取一帧。
-f 指定保存图片使用的格式,可忽略。
image-%3d.jpeg,指定文件的输出名字。
------------------------------------------------------------
ffmpeg -i WeChatSight2.mp4 -r 1 -f image2 image-%3d.jpeg
------------------------------------------------------------
2.取第一帧
-t 持续时间 (另一种写法 "-ss","00:00:00","-t","00:00:01")
------------------------------------------------------------
ffmpeg -i WeChatSight2.mp4 -r 1 -t 1  -f image2 image-%3d.jpeg
------------------------------------------------------------
3.取第一帧
-ss 指定开始时间
-vframes 指定帧数
-s 宽高
-an 新图片目录
------------------------------------------------------------
/usr/local/bin/ffmpeg -y -i WeChatSight2.mp4 -vframes 1 -ss 0:0:0 -f mjpeg -s 800*600 -an /Users/samson/Desktop/1.png

------------------------------------------------------------
推送流到rtmp协议地址
------------------------------------------------------------
ffmpeg -re -i /Users/Rick/Movies/Demo.mov -vcodec copy -f flv rtmp://localhost:1935/live1/room1

猜你喜欢

转载自samson870830.iteye.com/blog/2394341