How to Build FFmpeg for Android
http://www.roman10.net/how-to-build-ffmpeg-for-android/
ffmpeg is an open-source platform for recording, converting, playing and streaming video and audio. It includes libavcodec, a popular video/audio codec.
Several popular Android applications are built based on FFmpeg, including RockPlayer, MoboPlayer, acrMedia, vitalPlayer, V-Cut Express etc. If you’re developing multimedia applications that needs a video/audio codec, ffmpeg is a good choice.
This blog covers how to compile ffmpeg for Android, and next blog will cover how to use ffmpeg to build a simple application.
The steps below are done on Ubuntu 10.10, android NDK r5b, and ffmpeg 0.8. It should work on other versions of Android NDK and ffmpeg, but it may require minor changes.
0. Download Android NDK r5b
You can download the NDK here. Once downloaded, simply extract the file, and you’ll have a folder named android-ndk-r5b. You’ll need the folder location for configurations later.
1. Download Source Code for FFmpeg
You can download the source code from here. If you want to get the latest code, you can use git or svn, the link has detailed instructions. But for this tutorial, the FFmpeg 0.8 “Love” release is downloaded.
After downloaded the source, extract it and you’ll have a folder named ffmpeg-0.8.
2. Build FFmpeg (The script is based on RockPlayer build script)
2.1 Copy and Paste the bash script from here to a text editor, and save it as build_android.sh under ffmpeg-0.8 folder.
Note that NDK location has to be changed according to your android-ndk-r5b folder location. In my machine, it’s at ~/Desktop/android/, so it’s set as
NDK=~/Desktop/android/android-ndk-r5b
PLATFORM=$NDK/platforms/android-8/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
You may also need to adjust the PLATFORM based on which version of SDK you’re using, android-8 corresponds to android SDK 2.2.
The default configuration in the script disables a lot of stuff to speed up the build, you can change the configuration to suit your needs. Besides, you can compile for multiple hardware platforms, but here we only enable arm v7vfpv3 to speed up the build process.
2.2 Make sure the bash script is executable. Go to the ffmpeg-0.8 directory in terminal, then type the following command,
sudo chmod 755 build_android.sh
2.3 Then execute the script, by typing the following command,
./build_android.sh
The compilation will take a while (several minutes or above depends on your machine) to finish.
Update for NDK-r6:
For android NDK-r6, the build_android.sh script might not work. You can try the scripthere.
Note that you may need to create ./android/armv7-a/ folder in the ffmpeg directory yourself. (Thanks to mgg28831 for this).
If you encounter permission denied error, you can try sudo ./build_android.sh.
3. The Output of the Build
Once the script finishes execution, there’ll be a folder called android under ffmpeg-0.8 directory, which contains all the output of the build.
4. To be Continued
Once the library is compiled successfuly, the next step is to use it to build Android apps. This is covered in next blog, How to Build Android Apps Based on FFmpeg By an Example.
Reference:
RockPlayer open source component: http://rockplayer.freecoder.org/tech.html
How to Build FFmpeg for Android的更多相关文章
- How to build ffmpeg with hardware accelerated codecs for Android x86
In order to build a complete ffmpeg with hardware acceleration for Intel platform (XXX lake + Atom), ...
- [原]ffmpeg编译android 硬解码支持库 libstagefright
最近花了一天时间将ffmpeg/tools/build_stagefright执行成功,主要是交叉编译所需要的各种动态库的支持没链接上,导致各种报错,基本上网络上问到的问题我都碰到了,特此记录下来. ...
- FFmpeg在Android上的移植之第一步
http://blog.sina.com.cn/s/blog_69a04cf40100x1fr.html 从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmpeg开发的. ...
- FFmpeg在Android上的移植优化步骤
http://blog.csdn.net/feixiang_john/article/details/7894188 从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmp ...
- FFmpeg for Android compiled with x264, libass, fontconfig, freetype and fribidi
android下打算使用ffmpeg的 drawtext ,不过需要 --enable-libfreetype 但是freetype是个第三方库,所以需要先编译freetype,然后再编译ffmpe ...
- FFmpeg编译Android版本
FFmpeg是很好用的一个音视频库,功能强大,但是用起来并不是很方便.之前一直不想用FFmpeg,因为感觉编译太麻烦,但是到了不得不用的时候了,没办法,参考了网上大神的方法,在这里自己也记录一下方便以 ...
- ffmpeg 编译Android
环境 macOS 10.15.4 NDK 21.3.6528147 ffmpeg 4.2.3 1.执行sudo xcodebuild -license,防止编译的时候找不到一些文件报错 2. ...
- FFmpeg在Android Studio中断点调试
一般情况下在Android平台使用FFmpeg为动态库或静态库的形式,只能通过设置FFmpeg日志回调来看一些FFmpeg输出的日志,有时需要debug来查看FFmpeg内部执行过程,本文记录一下在A ...
- FFmpeg在Android使用3
android 移植ffmpeg后so库的使用 只需要将我们编译好的ffmpeg的so包(在/obj/local/armeabi/libffmpeg.so)copy到所在ndk下的\platfor ...
随机推荐
- wordpress代理设置
打开wp-config.php,在页首加上以下语句: define('WP_PROXY_HOST', '192.168.84.101'); define('WP_PROXY_PORT', '8080' ...
- 利用jQuery获取鼠标当前的坐标
文字来源:http://www.smalluv.com/jquery_code_106.html jQuery获取当前鼠标坐标位置: <div id="testDiv"> ...
- 在c#中使用mongo-csharp-driver操作mongodb
1)下载安装 下载地址:http://github.com/mongodb/mongo-csharp-driver/downloads 编译之后得到两个dll MongoDB.Driver.dll:顾 ...
- WinSock编程基础
一.套接字模式 1.阻塞模式 创建套接字时,默认是阻塞模式,对recv函数调用会使程序进入等待状态,知道接收到数据才返回. 2.非阻塞模式: 可以调用ioctlsocke ...
- python网络画图——networkX
networkX tutorial 绘制基本网络图 用matplotlib绘制网络图 基本流程: 1. 导入networkx,matplotlib包 2. 建立网络 3. 绘制网络 nx.draw() ...
- python os模块使用方法
os.path模块 basename('文件路径') 去掉目录路径,返回fname文件名 1 import os 2 os.path.basename('/Volumes/1.mp4') ...
- 第一个android应用程序
首先打开Eclipse和一个AVD.在Eclipse中选择File→New→Project→Android→Android Application Project 点击Next,按照下图所示填写 注: ...
- 刀哥多线程之主队列gcd-06-main_queue
主队列 特点 专门用来在主线程上调度任务的队列 不会开启线程 以先进先出的方式,在主线程空闲时才会调度队列中的任务在主线程执行 如果当前主线程正在有任务执行,那么无论主队列中当前被添加了什么任务,都不 ...
- 每日一练--C语言--串
目标 实现串的经典模式匹配算法与KMP算法. 简述 自定义串结构: 串采用定长顺序存储结构,串从下标1开始存储,0下标存储串的实际长度: 匹配成功返回匹配位置,匹配失败返回0. #include &l ...
- 内核堆分配函数brk()源码分析
Evernote公开链接:http://www.evernote.com/shard/s133/sh/5b8d3b26-0e53-4c61-aa43-66f6e87bbcb7/a44096dd557f ...