Linux下安装
1 | yum install epel-release |
RPM 安装
1 | yum list installed | grep ffmpeg |
Static Builds
参考
格式转换
相关参数
-c:v libx264
视频编码-c:a aac
音频编码-r
Set frame rate-aq
Set the audio quality (codec-specific, VBR). This is an alias for -q:a.
wmv to mp4
1 | ffmpeg -i input.wmv output.mp4 |
批量转换
1 | wmv转为mp4 |
比例缩放
1 | ffmpeg -i 1.mp4 -vf scale=-1:360 2.mp4 |
调整fps和比例
1 | ffmpeg -i 1.mp4 -filter:v fps=24,scale=-1:360 output/1.mp4 |
调整比特率和比例
1 | ffmpeg -i 1.mp4 -b:v 500K -vf scale=-1:360 output/1.mp4 |
参考
Stream selection
specific video and audio track
1 | // codec option has been set to copy |
截取段
指定时间段截取
1 | ffmpeg -i 1.mp4 -ss 00:00:30.000 -t 00:01:01.001 -vcodec copy output/1.mp4 |
合并 (concat)
- n Set the number of segments. Default is 2.
- v Set the number of output video streams, that is also the number of video streams in each segment. Default is 1.
- a Set the number of output audio streams, that is also the number of audio streams in each segment. Default is 0.
1 | ffmpeg -i part1.mp4 -i part2.mp4 -i part3.mp4 -i part4.mp4 \ |
h.264 - How to concatenate two MP4 files using FFmpeg? - Stack Overflow
排列(vstack & hstack)
1 | ffmpeg -i left.mp4 -i right.mp4 -filter_complex \ |
其他
查看信息 ffprobe
1 | ffprobe -i 1.mp4 -v quiet -print_format json -show_format -show_streams |
h.264 profile level
-profile:v high
high, main, or baseline-level:v 3.1
-refs 3
1 | ffmpeg -i 1.mp4 -b:v 500K -profile:v high -level:v 3.1 -refs 3 2.mp4 |
-brand mp42