最近想通过FFmpeg库来练习在Android中使用其他第三方库进行开发。本文基本按照Ubuntu 10.10 64bit下使用Android NDK r6编译FFmpeg 0.8.1实现,感谢原作者辛苦的工作。

1 下载相应的Android NDK r6文件
2 下载FFmpeg0.8.1的版本
截至到2011年10月2日已经发布了FFmpeg 0.8.5版本。

本文中系统之前已经配置过了NDK r6,我们通过控制台使用ndk-build不会出现找不到命令的情况。
本文的相关路径如下。

帮助
1 2 NDK目录为 /root/develop/android-ndk-r6 FFmpeg目录为 /root/develop/workspace/jni

3 创建一个可执行脚本:

帮助
1 2 3 4 5 6 7 8 9 10 11 12 13 ./configure --disable-static --enable-shared --enable-gpl --enable-version3 --enable-nonfree --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-postproc --enable-small --cross-prefix=/root/develop/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- --enable-cross-compile --target-os=linux --extra-cflags='-I/root/develop/android-ndk-r6/platforms/android-9/arch-arm/usr/include' --extra-ldflags='-L/root/develop/android-ndk-r6/platforms/android-9/arch-arm/usr/lib -nostdlib' --arch=arm --disable-symver --disable-debug --disable-stripping sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h

文件下载:
config.sh

本文为放到/root/develop/workspace/jni目录
4 使用命令

帮助
1 2 chmod 777 ./config.sh ./config.sh

执行后会有一个warning提示,但不影响最后编译.

帮助
1 WARNING: /root/develop/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.

5 创建一个Android.mk文件,放在 /root/develop/workspace/jni目录
内容参考Android.mk
本文使用的文件为
Android.mk

6 在/root/develop/workspace/jni目录下,执行

帮助
1 ndk-build

7 本文中会在/root/develop/workspace/libs/armeabi/中生成一个libffmpeg.so文件。

注意:
本人在做这个操作的时候,参考过How to Build FFmpeg for Android,但是并不成功。当然他提到的Android NDK r5 我没有测试过。

参考文章:
1 http://www.cnblogs.com/mcodec/articles/2114674.html
2 http://www.cnblogs.com/mcodec/articles/2114714.html
3 http://www.cnblogs.com/scottwong/archive/2010/12/17/1909455.html
4 http://blog.csdn.net/fsfcvictor/article/details/5972044
5 https://gist.github.com/1126971
6 http://www.cnblogs.com/shaobin0604/archive/2011/08/05/2128619.html
7 http://www.roman10.net/?p=389

主参考

http://www.cnblogs.com/shaobin0604/archive/2011/08/05/2128619.html

更多相关文章

  1. 读写Android中assets目录下的文件的方法详解
  2. Android(安卓)wifi密码的位置
  3. 浅谈android @id和@+id的区别
  4. Android(安卓)应用程序基础(对大家有个概括吧)
  5. Android存储和加载本地文件(内部存储设备)
  6. 只需五分钟,开始使用Kotlin开发Android
  7. Android(安卓)Adobe XMP与JPEG
  8. Android(安卓)Studio3.5 xml文件格式化(Reformat Code)后元素会
  9. Android实现在线预览office文档(Word,Pdf,excel,PPT.txt等格式)

随机推荐

  1. qt for android
  2. Android:TextView文字跑马灯的效果实现
  3. android 抽屉式滑动demo
  4. 修改ScrollView滚动条样式
  5. android inputmanager中事件的传递流程
  6. Android实现打电话功能
  7. 完美解决android Studio打开报错 https:/
  8. Android编译过程详解
  9. android发送短信
  10. Android(安卓)默认全面屏适配方案