我用FFMPEG拼接了视频。以下是代码:
ffmpeg -i "concat:video1.webm|video2.webm|video3.webm|video4.webm" -c copy output_video.webm
拼接完成后,我播放视频时只显示了video1,而video2、video3和video4都没有显示出来。虽然output_video.webm文件大小是完整的。我不知道为什么会出现这个问题?请帮我解决一下,怎样才能修复它呢?
非常感谢。 Bien
它无法工作是因为“concat协议”(也称为二进制连接)不支持“webm”文件格式。它支持avi,mpeg-ts。请查找FFMPEG Concat文档详细讨论此问题。
解决方案: 如上文所述,您可以使用更灵活的“concat demuxer”,如下所示:
ffmpeg -f concat -i mylist.txt -c copy output
Where mylist.txt is something like:
# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
在当前目录下,将两个mp4文件(video1.mp4和video2.mp4)合并的示例。
ffmpeg命令:
ffmpeg -f concat -i filelist.txt -c copy output.mp4
'filelist.txt'的内容
file 'video1.mp4'
file 'video2.mp4'
合并后的视频可在output.mp4中找到