问题描述
我想合并两个或多个视频文件(它们可能是两个 mp4 或两个 3gp,或任何其他格式).
I want to merge two or more video files (they may be two mp4 or two 3gp, or any other format).
推荐答案
您可以使用的最通用的工具是 ffmpeg(如上面@Jeremy 所述),但在手机上使用它需要一些工作;它也是 LGPL 许可的,它的一些编码器(特别是 x264)是 GPL.
The most generic tool you can use is ffmpeg (as noted by @Jeremy above), but using it on the mobile handset will require some work; also it is LGPL licensed and some of its encoders (notably x264) are GPL.
一个更简单的解决方案,如果您要连接的两个文件都使用相似的编码,并且包含在源自 MP4 的文件格式中(3GP 就是这样),则使用纯 Java MP4 解析器并连接视频而不触及媒体流本身.看看 mp4parser,这是一个纯 Java 的开源解析器,在 Apache 许可下获得许可,甚至有在其 wiki 中连接视频的示例.
A simpler solution, if both files you want to concatenate are using similar encoding, and are contained in file formats derived from MP4 (3GP is such), is to use a pure-java MP4 parser and concatenate the videos without touching the media stream itself. Have a look at mp4parser, an open-source parser that is pure-java, licensed under Apache license and even has an example for concatenating videos in its wiki.
这篇关于如何在 Android 中连接或合并两个或多个视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!