Use NDK compilation in Ubuntu to port FFmpeg2.0 (configure the latest version x264) to the Android platform

Source: Internet
Author: User
To configure x264 to ffmpeg, compile x264 to generate a static or dynamic library. Because 264 of the static library itself is not large (1.1 MB after compilation) and considering the platform porting problem, we chose to compile and generate the static library. Prepare and create a new workspace (1) Create the total directory FFmpeg-Androideg: mkdirworkspace -- & gt; cdworkspace -- & gt; mkdirFFmpeg-Android -- & gt; c

To configure x264 to ffmpeg, compile x264 to generate a static or dynamic library. Because 264 of the static library itself is not large (1.1 MB after compilation) and considering the platform porting problem, we chose to compile and generate the static library.

Prepare and create a workspace

(1) Create the total directory FFmpeg-Android

Eg: mkdir workspace --> cd workspace --> mkdir FFmpeg-Android --> cd FFmpeg-Android

(2) create a directory android-x264 that saves the x264 static library

(In the FFmpeg-Android directory) mkdir 264 --> cd 264

1. Compile x264

(1) Go to the official website: http://www.videolan.org/developers/x264.html to download the latest 264 source code. Here, we download version October 2013 from July 0.14. Decompress the compressed package to the ffmpeg-android/264 directory,

(2) Compile a script file:

Export NDK = $ NDK_HOME
Export PREBUILT = $ NDK/toolchains/arm-linux-androideabi-4.6/prebuilt
Export PLATFORM = $ NDK/platforms/android-19/arch-arm
Export PREFIX =.../../android-x264

./Configure -- prefix = $ PREFIX \
-- Enable-static \
-- Enable-pic \
-- Disable-asm \
-- Disable-cli \
-- Host = arm-linux \
-- Cross-prefix = $ PREBUILT/linux-x86_64/bin/arm-linux-androideabi -\
-- Sysroot = $ PLATFORM

Note: The variables involved in the path need to be adjusted according to your own situation.

The PREBUILT variable stores the path of the NDK cross-compilation chain,

The PLATFORM variable stores the path of the library file when the NDK is linked (the arch-arm directory stores the c library header files and static and dynamic libraries under various andorid platforms)

The PREFIX variable stores the path of the static library generated by the compilation.

(3) run the script. The result is as follows:

 

(4) After executing the script, the configuration file will be generated in the current directory. Here, you need to modify the following files because: after compilation is successful, the "cannot locate symbol 'log2f '" error will occur when running in eclipse.

Modify 1. config. h

---- # Define HAVE_LOG2F 1

++ # Define HAVE_LOG2F 0

 

Modify 2. encoder/encoder. c, encoder/ratecontrol. c, encoder/analyze. c, encoder/set. c

Add at the beginning of the file

+++ # Include

++ //

FFmpeg details: Click here
FFmpeg: Click here

Recommended reading:

Compile FFmpeg in Linux and compile the source file

Linux compiling upgrade FFmpeg step http://www.linuxidc.com/Linux/2013-08/88190.htm

Install FFMPEG http://www.linuxidc.com/Linux/2011-09/42793.htm on CentOS 5.6

Install FFmpeg http://www.linuxidc.com/Linux/2012-12/75408.htm in Ubuntu

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.