FFmpeg 视频旋转、混音等常用命令

1.audio

1
ffmpeg -i test.aac -i test.mp3 -filter_complex "[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.9[a0]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [a0][a1]amerge=inputs=2[aout]" -map "[aout]" -ac 2 mix_v0.5.aac

2.video

1
ffmpeg -i test.mp4 -i test.mp4 -filter_complex "[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.9[a0]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [a0][a1]amix=inputs=2:duration=first[aout]" -map "[aout]" -ac 2 -c:v copy -map 0:v:0 mix_amerge.mp4

3.视频旋转(rotate 90度)

1
ffmpeg -y -i test.mp4 -metadata:s:v rotate=90 -codec copy test_.mp4

4.多个视频合成(相同码率、分辨率等)

1
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy composer.mp4

注:concat.txt内容为多个视频路径

1
2
3
file 1.mp4
file 2.mp4
...