0%

ffmpeg合并多个视频文件

ffmpeg合并多个视频文件

方法一: 直接合并

  • 在视频所在文件夹下创建一个文本文件(前提是你所写的 file 文件存在)
>>> vim 2.txt

file '01.mp4'
file '02.mp4'
file '03.mp4'
file '04.mp4'
file '05.mp4'
file '06.mp4'
file '07.mp4'
file '08.mp4'
file '09.mp4'
file '10.mp4'
file '11.mp4'
file '12.mp4'

>>> :wq
  • 用ffmpeg合并所有视频
ffmpeg -f concat -safe 0 -i 2.txt -c copy -y o1.mp4
# -f concat是指合并
# -safe 为了避免权限报错
# -c copy 一定要指定,不然会重新封装,数据文件就会变大。