我已经在Android上编译了FFmpeg (libffmpeg.so)。现在我必须构建一个应用程序,如RockPlayer或使用现有的Android多媒体框架来调用FFmpeg。

你有在Android / StageFright上集成FFmpeg的步骤/过程/代码/示例吗? 你能指导我如何使用这个库来播放多媒体吗? 我有一个需求,我已经有音频和视频传输流,我需要将其馈送到FFmpeg并将其解码/渲染。我怎么能在Android上做到这一点,因为IOMX api是基于OMX的,不能在这里插件FFmpeg ? 我也找不到FFmpeg api的文档,需要用于回放。


当前回答

我也有同样的问题,我发现这里的大多数答案都过时了。 我最终在FFMPEG上编写了一个包装器,用一行代码从Android访问。

https://github.com/madhavanmalolan/ffmpegandroidlibrary

其他回答

以下是我在让ffmpeg在Android上工作时所经历的步骤:

Build static libraries of ffmpeg for Android. This was achieved by building olvaffe's ffmpeg android port (libffmpeg) using the Android Build System. Simply place the sources under /external and make away. You'll need to extract bionic(libc) and zlib(libz) from the Android build as well, as ffmpeg libraries depend on them. Create a dynamic library wrapping ffmpeg functionality using the Android NDK. There's a lot of documentation out there on how to work with the NDK. Basically you'll need to write some C/C++ code to export the functionality you need out of ffmpeg into a library java can interact with through JNI. The NDK allows you to easily link against the static libraries you've generated in step 1, just add a line similar to this to Android.mk: LOCAL_STATIC_LIBRARIES := libavcodec libavformat libavutil libc libz Use the ffmpeg-wrapping dynamic library from your java sources. There's enough documentation on JNI out there, you should be fine.

关于使用ffmpeg进行回放,有很多例子(ffmpeg二进制本身就是一个很好的例子),这里是一个基本教程。最好的文档可以在标题中找到。

祝你好运。

为了使我的FFMPEG应用程序,我使用了这个项目(https://github.com/hiteshsondhi88/ffmpeg-android-java),所以,我不需要编译任何东西。我认为这是在我们的Android应用程序中使用FFMPEG的简单方法。

更多信息http://hiteshsondhi88.github.io/ffmpeg-android-java/

我发现最容易构建、最容易使用的实现是由guardianproject团队制作的:https://github.com/guardianproject/android-ffmpeg

经过大量的研究,现在这是我发现的最新的Android编译库:

https://github.com/bravobit/FFmpeg-Android

目前使用的是FFmpeg版本n4.0-39-gda39990 包括FFmpeg和FFProbe 包含用于启动命令的Java接口 FFprobe或FFmpeg可以从APK中删除,检查维基https://github.com/bravobit/FFmpeg-Android/wiki

我做了一个小项目,使用Android NDK配置和构建X264和FFMPEG。主要缺少的是一个像样的JNI接口,可以通过Java访问它,但这是比较容易的部分(相对而言)。当我腾出时间使JNI接口适合我自己使用时,我将把它推进去。

与olvaffe的构建系统相比,它的优势在于不需要Android。Mk文件来构建库,它只使用常规的makefiles和工具链。这使得当你从FFMPEG或X264中做出新的改变时,它不太可能停止工作。

https://github.com/halfninja/android-ffmpeg-x264