编译环境:
Ubuntu 12.04;
Android-ndk-r9;
ffmpeg 在运行shell脚本的时候自动下载最新版本;
首先,编译前需要安装ccache:
ccache is a software development tool that caches the output of C/C++compilation so that the next time, the same compilation can be avoided and the results can be taken from the cache. This can greatly speed up recompiling time. ------From Wikipedia
源码下载:http://ccache.samba.org/download.html
安装ccache:
- tar -xvf ccache-3.1.9.tar.bz2
- cd ccache-3.1.9
- ./configure
- make
- make install //Mac系统安装需要加上sudo,即sudo make install
第二步: 从GitHub下载开源项目代码: FFmpeg-Android
- git clone https://github.com/yixia/FFmpeg-Android
- sudo apt-get install git
第三步:编译这个项目
进入此项目目录
- $ export ANDROID_NDK=/path/to/your/android-ndk #导出你的NDK目录
- $ ./FFmpeg-Android.sh #运行这个shell文件
闭目养生5分钟,就会出现令你兴奋的结果
libffmpeg.so will be built to build/ffmpeg/{neon,armv7,vfp,armv6}
至此你就会发现这个编译过程是多么简单便捷,不许要在ffmpeg源码中添加任何make文件,不需要编写任何shell脚本,甚至不用自己去下载ffmpeg源码。