简体   繁体   English

如何将单个图像与视频文件合并并创建 MP4 视频文件作为 Android 中的输出?

[英]How to merge a single image with a video file and create a MP4 video file as an output in Android?

anyone know how to merge a single image with already selected video in android through any library because i cannot find any solution for this issue i have checked some libraries such as FFmpeg and OpenCV but they seem not to help in my case Thanks!任何人都知道如何通过任何库将单个图像与 android 中已选择的视频合并,因为我找不到解决此问题的任何方法我已经检查了一些库,例如 FFmpeg 和 OpenCV,但它们似乎对我的情况没有帮助谢谢!

ffmpeg can definitely overlay an image over a video if this is what you are looking for.如果这是您正在寻找的,ffmpeg 绝对可以在视频上叠加图像。

The documentation provides some some examples - they key option is 'filter-complex':该文档提供了一些示例 - 它们的关键选项是“filter-complex”:

ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv

See here for the official documentation: https://ffmpeg.org/ffmpeg.html and look at '-filter_complex filtergraph (global)'有关官方文档,请参见此处: https ://ffmpeg.org/ffmpeg.html 并查看“-filter_complex filtergraph (global)”

ffmpeg is designed as a command line tool, but there exist 'wrapper' projects to allow it be used from an Android app. ffmpeg 被设计为命令行工具,但存在“包装器”项目以允许从 Android 应用程序中使用它。 A well supported example is below but others exist also:下面是一个得到很好支持的示例,但也存在其他示例:

The above includes a sample APK so you can try out the ffmpeg command you need with that to ensure it works before adding to your own project.上面包含一个示例 APK,因此您可以尝试使用所需的 ffmpeg 命令来确保它在添加到您自己的项目之前有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM