【问题标题】:Image overlay on video using ffmpeg android使用ffmpeg android在视频上叠加图像
【发布时间】:2018-03-14 21:21:36
【问题描述】:

我正在尝试使用 ffmpeg 库在视频上添加图像叠加,但没有成功。

我尝试了使用 ffmpeg 的示例,https://drive.google.com/file/d/0B2aT0QoEmtuaN0VJZ2Z4ODY3T2s/view

并将此链接也称为覆盖视频上的图像,http://ksloan.net/watermarking-videos-from-the-command-line-using-ffmpeg-filters/#comment-9793 但出现错误。

以下是我的 logcat 错误供参考:

07-31 10:23:43.406 29517-29517/com.examples.ffmpeg4android_demo D/ffmpeg4android: /storage/emulated/0/videokit/in.mp4 字节长度:840896 07-31 10:23:43.432 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android: doInBackground 开始... 07-31 10:23:43.432 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android: vk 已删除: false 07-31 10:23:43.434 29517-30185/com.examples.ffmpeg4android_demo D/ffmpeg4android: 获取唤醒锁 07-31 10:23:43.479 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android: =======运行第一个命令========= 07-31 10:23:43.479 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android: 运行 ffmpeg4android_lib: 322.00.02_LM322 07-31 10:23:43.479 29517-30185/com.examples.ffmpeg4android_demo D/ffmpeg4android: {"ffmpeg","-y","-loop","1","-i","/sdcard/videokit /logo.png","-i","/sdcard/videokit/in.mp4","-y","-filter_complex","overlay=0:0:shortest=1","/sdcard/videokit/ out.m4v"} 07-31 10:23:43.485 29517-30185/com.examples.ffmpeg4android_demo D/ffmpeg4android:/sdcard/videokit/logo.png 字节长度:6047 07-31 10:23:43.486 29517-30185/com.examples.ffmpeg4android_demo D/ffmpeg4android:/sdcard/videokit/in.mp4 字节长度:840896 07-31 10:23:43.486 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android: videokitLibPath 退出 07-31 10:23:43.486 29517-30185/com.examples.ffmpeg4android_demo I/ffmpeg4android:/data/user/0/com.examples.ffmpeg4android_demo/lib/libvideokit.so 07-31 10:23:43.493 29517-30185/com.examples.ffmpeg4android_demo I/Videokit: libvideokit.so 加载 07-31 10:23:43.493 29517-30185/com.examples.ffmpeg4android_demo I/Videokit: args 不为 NULL 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo I/Videokit: 不止一个参数 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo I/Videokit: 找到函数符号 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo D/Videokit: 调用 videokit 通过加载器运行 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo D/Videokit:调用 licenseCheckComplex 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo I/Videokit: isLicExistsComplex... 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo I/Videokit:您使用了 15 个试用天中的 1 个。 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo D/Videokit: 许可证检查 rc: 0 07-31 10:23:43.494 29517-30185/com.examples.ffmpeg4android_demo D/Videokit: ffmpeg4android base 2.5

                                                                        --------- beginning of crash

07-31 10:23:43.584 29517-30185/com.examples.ffmpeg4android_demo A/libc:致命信号 11 (SIGSEGV),代码 1,tid 30185 (AsyncTask #1) 中的故障地址 0x0 07-31 10:23:44.432 29517-29517/com.examples.ffmpeg4android_demo I/Choreographer:跳过了 44 帧!应用程序可能在其主线程上做了太多工作。

【问题讨论】:

  • 如果您使用的是ffmpeg 命令行工具,请显示您的实际命令和完整的控制台/日志输出。如果您使用的是 FFmpeg 库,请显示您的代码。
  • 使用的命令是“ffmpeg -y -loop 1 -i /sdcard/videokit/logo.png -i /sdcard/videokit/in.mp4 -y -filter_complex overlay=0:0:shortest= 1 /sdcard/videokit/out.m4v"
  • Logcat 运行 ffmpeg4android_lib:322.00.02_LM322 /sdcard/videokit/logo.png 字节长度:6047 /sdcard/videokit/in.mp4 字节长度:840896 videokitLibPath 退出 /data/user/0/ com.examples.ffmpeg4android_demo/lib/libvideokit.so libvideokit.so 加载的 args 不是 NULL 多于一个 arg 调用 videokit 通过加载程序调用 licenseCheckComplex isLicExistsComplex ... ffmpeg4android base 2.5 A/libc:致命信号 11(SIGSEGV),代码 1 , tid 30185 (AsyncTask #1) 中的故障地址 0x0 编排:跳过 44 帧!应用程序可能在其主线程上做了太多工作
  • @LordNeckbeard 我无法添加所有 logcat 消息,因为它们是字符限制限制。希望这个 logcat 有意义。
  • ffmpeg 本身没有日志输出吗?您应该 edit 您的问题以添加新信息,而不是尝试将其放入多个 cmets 中。

标签: image video ffmpeg overlay


【解决方案1】:

您可以使用 ffmpeg Android 包装器和常规 ffmpeg 命令行语法(它得到很好的支持和记录)来实现这一点 - 请记住,移动设备上的视频处理占用大量 CPU,因此可能比您愿意,也可能会影响电池使用量。

以下是一个得到很好支持的 ffmpeg 包装器:

您可以使用 ffmpeg 使用如下命令添加图像:

ffmpeg -i inputVideo.mp4 -i yourImage.png -filter_complex "overlay=5:5" -codec:a copy outputVideo.mp4

有关放置图像的更多示例,请参阅此答案 - 即左上角、右下角等:https://stackoverflow.com/a/10920872/334402

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 2021-08-16
    • 2019-08-15
    • 2018-09-18
    • 2022-08-08
    • 2014-10-10
    • 2021-03-16
    相关资源
    最近更新 更多