FFMpeg & x264 compile for using with Android NDK on Mac OSX

1. Toolchain for compile (This NDK version is r8)
a. Android’s NDK allows we to create toolchain installation using “make-standalone-toolchain.sh” script.
b. Execute like below.
$> $NDK/build/tools/make-standalone-toolchain.sh –platform=android-14 –install-dir=/work/my-android-toolchain
c. You can use directly with PATH, CC setting.
export PATH=/work/my-android-toolchain/bin:$PATH
export CC=arm-linux-androideabi-gcc
d. Done

2. Compile & Build x264 project for FFMpeg library.
a. Download x264 project (http://www.videolan.org/developers/x264.html)
b. Configuration for arm compile. (prefix option is very important for FFMpeg compiling.)
$> ./configure –host=arm-linux \
–cross-prefix=arm-linux-androideabi- \
–enable-shared \
–enable-static \
–prefix=/work/my-android-toolchain/sysroot/usr
c. make / install
$> make
$> make install
d. Done. You can find the library & include files in –prefix option’s directory.

3. Compile & Build FFMpeg project.
a. Download FFMpeg source code from http://ffmpeg.org/download.html (This case is FFmpeg 0.10.3 “Freedom” version)
b. Configuration for arm compile.
$> ./configure –enable-shared \
–enable-libx264 \
–cross-prefix=arm-linux-androideabi- \
–enable-cross-compile \
–target-os=linux \
–arch=arm \
–enable-gpl \
–prefix=/work/my-android-toolchain/sysroot/usr
c. Configuration for detailed module selection.
$> ./configure –prefix=../ffmpeg_build \
–enable-gpl \
–enable-shared \
–disable-doc \
–disable-ffmpeg \
–disable-ffplay \
–disable-ffprobe \
–disable-ffserver \
–disable-avdevice \
–disable-debug \
–disable-network \
–disable-protocols \
–disable-devices \
–disable-encoders \
–disable-decoders \
–disable-muxers \
–disable-demuxers \
–disable-parsers \
–disable-bsfs \
–disable-filters \
–enable-encoder=h264 \
–enable-libx264 \
–extra-cflags=-U__STRICT_ANSI__ \
–target-os=linux \
–extra-cflags=”-fno-short-enums” \
–extra-ldflags=”-mandroid -lm” \
–enable-cross-compile \
–cross-prefix=arm-linux-androideabi- \
–arch=arm
d. Make
$> make

e. Make install

$> make install

f. Done. You can see the library and header in ../ffmepg_build directory (in the prefix option)

Posted in Uncategorized | 6 Comments

Hello world!

Welcome to WordPress.com! This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Happy blogging!

Posted in Uncategorized | 1 Comment