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

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

问题描述

我想使用 ffmpeg 将两个 mp4 视频组合成一个 mp4 视频.

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

到目前为止我尝试的是

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 FAQ 了解有关加入文件的信息.

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天全站免登陆