Compile x264 for Android

This tutorial is to generate shared library that ffmpeg needed to enable x264 support for different platforms (armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips).

1. Download and Unzip x264

Download x264 from the link.

2. Download build scripts of ffmpeg & x264 for android ndk from my repository

Link to my ffmpeg + x264 build scripts repository

3. Copy build scripts into x264 folder

Copy the scripts inside build-scripts-of-ffmpeg-x264-for-android-ndk-master/x264 to your downloaded x264 src code folder. Ex.

cp build-scripts-of-ffmpeg-x264-for-android-ndk-master/x264/* x264/

Open text editor, check each build script, whether the ndk path and toolchain path are correct or not.

#check the paths bellow, make sure any words is correct.
#for ex. if you want to build shared libraries for arm64, the lowest platform level is 21. for 32 bits, usually i choose android-18. (as you want)
NDK=/Users/yesimroy/Library/Android/sdk/ndk-bundle
PLATFORM=$NDK/platforms/android-21/arch-arm64/
PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64

4. Run the build-all script for generating all platform shared library

Run the build-all script and wait for it, you can check the console logs in case there is an error.

cd x264

./build_android_all.sh

5. After compiling success

After compiling success, you will see an folder called android including all platform libraries inside your ffmpeg folder.

╭─yesimroy@RoyMBPR  ~/Documents/x264 
╰─$ ls android
arm    arm64  mips   mips64 x86    x86_64