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的更多相关文章

  1. 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), ...

  2. [原]ffmpeg编译android 硬解码支持库 libstagefright

    最近花了一天时间将ffmpeg/tools/build_stagefright执行成功,主要是交叉编译所需要的各种动态库的支持没链接上,导致各种报错,基本上网络上问到的问题我都碰到了,特此记录下来. ...

  3. FFmpeg在Android上的移植之第一步

    http://blog.sina.com.cn/s/blog_69a04cf40100x1fr.html 从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmpeg开发的. ...

  4. FFmpeg在Android上的移植优化步骤

    http://blog.csdn.net/feixiang_john/article/details/7894188 从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmp ...

  5. FFmpeg for Android compiled with x264, libass, fontconfig, freetype and fribidi

    android下打算使用ffmpeg的 drawtext ,不过需要 --enable-libfreetype  但是freetype是个第三方库,所以需要先编译freetype,然后再编译ffmpe ...

  6. FFmpeg编译Android版本

    FFmpeg是很好用的一个音视频库,功能强大,但是用起来并不是很方便.之前一直不想用FFmpeg,因为感觉编译太麻烦,但是到了不得不用的时候了,没办法,参考了网上大神的方法,在这里自己也记录一下方便以 ...

  7. ffmpeg 编译Android

    环境 macOS 10.15.4    NDK 21.3.6528147   ffmpeg 4.2.3 1.执行sudo xcodebuild -license,防止编译的时候找不到一些文件报错 2. ...

  8. FFmpeg在Android Studio中断点调试

    一般情况下在Android平台使用FFmpeg为动态库或静态库的形式,只能通过设置FFmpeg日志回调来看一些FFmpeg输出的日志,有时需要debug来查看FFmpeg内部执行过程,本文记录一下在A ...

  9. FFmpeg在Android使用3

    android 移植ffmpeg后so库的使用   只需要将我们编译好的ffmpeg的so包(在/obj/local/armeabi/libffmpeg.so)copy到所在ndk下的\platfor ...

随机推荐

  1. ElasticSearch-PHP的API使用(二)

    1:索引内的一个文档的创建(相当表记录的添加) 比如:要添加一条记录 INSERT INTO blog(title,content,add_time) VALUES('ElasticSearch-PH ...

  2. 爱之初体验---编译加载内核模块hello

    1. hello.c #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h ...

  3. Winfrom 基于TCP的Socket 编程

    基于TCP的Socket基础例子 服务端的代码 public partial class Form1 : Form { public Form1() { InitializeComponent(); ...

  4. 原生jdbc执行存储过程

    //定时任务,结转 . //表名 fys_sch_lvyou2 ,存储过程名:fys_sch_lvyou2_carrayover //无参调用:{call insertLine} //有参调用:{ca ...

  5. MIME类型

    多用途互联网邮件扩展(MIME,Multipurpose Internet Mail Extensions)是一个互联网标准,它扩展了电子邮件标准,使其能够支持非ASCII字符.二进制格式附件等多种格 ...

  6. 苹果Mac OS系统shell命令大全介绍

    基本命令 1.列出文件 ls 参数 目录名        例: 看看驱动目录下有什么:ls /System/Library/Extensions 参数 -w 显示中文,-l 详细信息, -a 包括隐藏 ...

  7. ubuntu打开 txt 文件乱码

    ubuntu12.04 gedit 打开 windows 分区中的 txt 文件乱码,是因为 ubuntu 和 windows 两个系统的编码不同.解决办法:终端里依次输入以下2 条命令即可: 代码: ...

  8. Struts2中的namespace使用

    namespace一般在项目比较复杂的情况下使用较好. 在struts2的项目中,namespace主要在以下环境中常使用: 1. 在配置文件中(struts.xml)以及被它包含的XX.xml文件中 ...

  9. 修改后的SQL分页存储过程,利用2分法,支持排序

    /****** Object: StoredProcedure [dbo].[sys_Page_v3] Script Date: 08/13/2014 09:32:28 ******/ SET ANS ...

  10. Delphi的基本函数

    Delphi的基本函数 函数由一句或多句代码组成,可以实现某个特定的功能.使用函数可以使代码更加易读.易懂,加快编程速度及减少重复代码.过程与函数类似,过程与函数最重要的区别在于,过程没有返回值,而函 ...