如何使用ffmpeg合并两个avi文件? [英] Howto merge two avi files using ffmpeg?

查看:655
本文介绍了如何使用ffmpeg合并两个avi文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将两个AVI视频合并在一起。
谷歌充满了以下例子:

I'm unable to merge two avi videos together. google is full of below examples:

cat file1.avi file2.avi file3.avi > video_draft.avi
after appending the data together using cat above, you need to re-index the draft movie like this:

mencoder video_draft.avi -o video_final.avi -forceidx -ovc copy -oac copy
Now you're video_final.avi file will be right to go.

但它对我来说不起作用,第一个视频被转换,就是这样。 >

but it doesn't work for me, the first video is converted and that's it.

推荐答案

您应该查看 concat demux和concat协议。假设编解码器是相同的,您创建一个文件(例如 mylist.txt ):

You should look into the concat demux and concat protocol that was added in ffmpeg 1.1. Assuming the codecs are the same you create a file (example mylist.txt):

file '/path/here/file1.avi'
file '/path/here/file2.avi'
file '/path/here/file3.avi'

然后将该文件传递给ffmpeg

Then pass that file to ffmpeg

ffmpeg -f concat -i mylist.txt -c copy video_draft.avi

你可以使用此命令列出:

You can use this command to make the list:

ls *.avi | while read each; do echo "file '$each'" >> mylist.txt; done

链接页面具有更多高级示例,用于处理像不同编解码器/格式的问题。

The linked page has more advanced examples for dealing with issue like different codecs/formats.

这篇关于如何使用ffmpeg合并两个avi文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆