结合ffmpeg的两个视频 [英] Combining two video from ffmpeg

查看:104
本文介绍了结合ffmpeg的两个视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ffmpeg将两个mp4视频合并为一个mp4视频.

I want to combine two mp4 videos to form a single mp4 video using ffmpeg.

到目前为止我尝试过的是

what i tried so far is

ffmpeg -i input1.mp4 -i input2.mp4 output.mp4

但是,每次我得到的视频都带有第一个输入的视频编解码器,而不是另一个.我如何将它们结合在一起?任何对此的想法将不胜感激.

But, every time i get the video with video codec of first input and not the other. How can i combine them? Any idea on this will be highly appreciated.

推荐答案

请阅读FFMPEG 常见问题解答以获取有关加入文件的信息.

Please read the FFMPEG FAQ for information about joining files.

不幸的是,由于您使用的是MP4文件,因此简单的串联对您不起作用,因为MP4格式包含标头"(尽管不一定必须在文件的开头)部分描述并包含媒体数据的偏移量.您将需要将这两个文件转码为可以连接的格式,然后从该格式生成MP4文件(这将生成一个适当的标头部分).

Unfortunately, since you're using MP4 files, simple concatenation won't work for you because the MP4 format contains a "header" (although it doesn't necessarily have to be at the beginning of the file) section that describes and contains offsets into the media data. You will need to transcode both files to a format that can be concatenated and then generate an MP4 file from that format (which will generate an appropriate header section).

这篇关于结合ffmpeg的两个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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