站在巨人的肩膀上--傻瓜式编译ffmpeg for android

本文介绍了一种在Ubuntu环境下使用FFmpeg-Android项目进行FFmpeg库编译的简便方法。仅需安装ccache并运行指定Shell脚本即可完成整个编译流程,无需修改Makefile或编写额外脚本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

经过啦无数次失败,在快要放弃的时候,明明向我伸出温暖的援手,顿时拨云见日,柳暗花明……wake up,说正事:

说傻瓜式的编译毫不为过,当你尝试过按照网络上一些博客的方法编译不过的时候,就会感受到这里有多么傻瓜。


编译环境:

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
没有安装git的要先安装git:

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源码。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值