在 Android 上使用 FFMPEG [英] Use FFMPEG on Android

查看:24
本文介绍了在 Android 上使用 FFMPEG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在Android上使用FFMPEG将YUV420帧转换为H.264吗?

Does somebody know how to use FFMPEG on Android to convert YUV420 frame to H.264?

我已经使用 NDK 在 Android 上移植了 FFMPEG 工作,我只是不知道如何使用它.源代码表示赞赏.

I have ported FFMPEG work on Android with NDK, I just don't know how to use it. A source code is appreciated.

推荐答案

您有两个选择:

  1. 使用 ffmpeg api - 谷歌 ffmpeg示例代码.这需要好的了解api和哪些非常全面.
  2. 编译 ffmpeg.c 并调用它main() 通过 jni.这要求你懂命令行参数.比较麻烦但有效.

  1. use ffmpeg api - google ffmpeg sample code. this requires good understanding of the api and which is very comprehnsive.
  2. compile ffmpeg.c and invoke its main() via jni. This requires that you understand the command line parameters. It is rather cumbersome but works.

您需要注意 ffmpeg.c 中定义的静态变量,并在每次调用 main 函数时重置它们.还要确保不要同时在两个线程中调用 main.

You need to look out for the static vars defined in ffmpeg.c and reset them every time you invoke the main function. Also make sure you don't invoke the main in two threads simultaneously .

这篇关于在 Android 上使用 FFMPEG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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