> For the complete documentation index, see [llms.txt](https://jiek.gitbook.io/android/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jiek.gitbook.io/android/code/ffmpeg.md).

# FFMPEG

官方有基础的ndk build jni的所有基础用法。[googlesamples](https://github.com/googlesamples/android-ndk)

1. build ffmpeg for android
   1. download resource > <https://ffmpeg.org/download.html#releases>
   2. create build.sh

      > touch $FFMPEG\_dir/build.sh
      >
      > ```
      > #!/bin/bash
      > cd ffmpeg
      > export TMPDIR=/Users/jiek/workspace/ffmpeg/tempdir
      > NDK=/Users/Shared/sdk/ndk-bundle
      > SYSROOT=$NDK/platforms/android-16/arch-arm/
      > TOOLCHAIN=/Users/Shared/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
      > CPU=arm
      > PREFIX=/Users/jiek/workspace/ffmpeg/output
      > ADDI_CFLAGS="-marm"
      > function build_one
      > {
      > ./configure \
      >    --prefix=$PREFIX \
      >    --enable-shared \
      >    --disable-static \
      >    --disable-doc \
      >    --disable-ffmpeg \
      >    --disable-ffplay \
      >    --disable-ffprobe \
      >    --disable-ffserver \
      >    --disable-doc \
      >    --disable-symver \
      >    --enable-small \
      >    --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
      > }
      > build_one
      > cd ../
      > ```
   3. run build

      > $ ./build.sh output a number of SO files in `$PREFIX` folder.
2. build android project Env.
   1. Use Android studio 2.3 IDE
   2. checked include C++ support.
   3.
