用FFmpeg合并视频
相同编码
输入文本文件
You can read about the concat demuxer in the documentation. This demuxer reads a list of files and other directives from a text file and demuxes them one after the other, as if all their packets had been muxed together. All files must have the same streams (same codecs, same time base, etc.) but can be wrapped in different container formats.
创建文本文件,写入要合并的文件,绝对或相对路径皆可:
# this is a comment
file '/path/to/file1.wav'
file '/path/to/file2.wav'
file '/path/to/file3.wav'
然后复制流或重编码文件:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.wav
如果使用相对路径,就无需-safe 0。
只用命令行
While the demuxer works at the stream level, the concat protocol works at the file level. Certain files (MPEG-2 transport streams, possibly others) can be concatenated. This is analogous to using cat on UNIX-like systems or copy on Windows.
说明
ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.ts
不同编码
待续……
浙公网安备 33010602011771号