ffmpeg android build

Under linux mint 17.4, you can choose any OS, even cygwin.

  1. download android ndk, in this document, I used “android-ndk-r14b”
  2. download ffmpeg source, http://www.ffmpeg.org/download
  3. unzip ndk
  4. make standalone compiler
    • $NDK/build/tools/make-standalone-toolchian.sh --platform=android-21 --install-dir=~/home/android_toolchain
    • “android-21” means minimum sdk, 21 is android 6.0 marshmallow
  5. make android build script
    • in $FFMPEG directory,
    • NDK=/home/kjkim/android-ndk-r14b
      SYSROOT=$NDK/platforms/android-21/arch-arm
      TOOLCHAIN=/home/kjkim/android_toolchain
      function build_one
      {
      ./configure \
          --prefix=$PREFIX \
          --enable-shared \
          --disable-static \
          --disable-doc \
          --disable-ffmpeg \
          --disable-ffplay \
          --disable-ffprobe \
          --disable-ffserver \
          --disable-avdevice \
          --disable-doc \
          --disable-symver \
          --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
          --target-os=linux \
          --arch=arm \
          --enable-cross-compile \
          --sysroot=$SYSROOT \
          --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
          --extra-ldflags="$ADDI_LDFLAGS" \
          $ADDITIONAL_CONFIGURE_FLAG
      make clean
      make
      make install
      }
      CPU=arm
      PREFIX=$(pwd)/android/$CPU
      ADDI_CFLAGS="-marm"
      build_one