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)
Hello there,
Very nice tutorial, just what I needed. Did you perform this on Mac using Linux or MacOsX?
Yes, it’s tested on Mac OS X Lion version. I didn’t compile on Linux but it might be well.
I have tried your build script for x264, however i am getting an error which basically says all the options are unknown and there is no c compiler found. Any ideas about that would be brilliant
May I know the error message for detail?
Thank you for your answer. I have started to build ffmpeg and x264 this week and i am pretty inexperienced when it comes to script writing,therefore i think i am missing some basic stuff.
Toolchain builds well but when i try to configure x264 with the code piece you have provided, i get the following error.
Unknown option –host=arm-linux, ignored
Unknown option –cross-prefix=arm-linux-androideabi-, ignored
Unknown option –enable-shared, ignored
Unknown option –enable-static, ignored
Unknown option –prefix=/work/my-android-toolchain/sysroot/usr, ignored
No working C compiler found.
I have been trying another build script for x264. using http://demo860.blogspot.co.uk/2010/06/ffmpeg-libx264-build-for-android.html this website. I get no errors related to unknown options but still facing the c compiler error. I have updated build-essentials both with apt-get and aptitude, I know they are up to date but c compiler doesnot want to be found apparently. Also, I have downloaded ndk 4 for the above tutorial since toolchain differences might cause some problems.
Thanks again for you answer.
Best
Actually, by correcting the syntax I have managed to get rid of the errors except no working c compiler found part. Build essentials is installed and up to date. I can’t seem to find the erroneous part.