NDK版本:android-ndk-r14b
ffmpeg版本:4.2.4 / 4.4
Ubuntu版本:15.5
#!/bin/bash
NDK=/home/linrendi/Desktop/Compile/android-ndk-r14b
PLATFORM=$NDK/platforms/android-21/arch-arm64
TOOLCHAIN=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
PREFIX=/home/linrendi/Desktop/ffmpeg64
CPU=armv8-a
function build_one
{
./configure \
--prefix=$PREFIX \
--target-os=android \
--disable-doc \
--cross-prefix=$TOOLCHAIN/bin/aarch64-linux-android- \
--arch=arm64 \
--cpu=$CPU \
--disable-asm \
--sysroot=$PLATFORM \
--extra-cflags="-I$PLATFORM/usr/include" \
--cc=$TOOLCHAIN/bin/aarch64-linux-android-gcc \
--nm=$TOOLCHAIN/bin/aarch64-linux-android-nm \
--disable-shared --enable-static \
--enable-small --disable-debug \
--disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-symver \
--enable-neon --enable-pthreads \
--disable-devices --disable-encoders \
--enable-hwaccels --enable-jni --enable-mediacodec \
--enable-encoder=aac \
--enable-decoder=h264_mediacodec \
--enable-hwaccel=h264_mediacodec \
--enable-encoder=mjpeg \
--enable-encoder=ljpeg --enable-encoder=jpeg2000 --enable-encoder=jpegls \
--enable-muxer=mp4 --enable-muxer=mjpeg \
--enable-runtime-cpudetect \
make clean
make -j4
make install
$TOOLCHAIN/bin/aarch64-linux-android-ld \
-rpath-link=$PLATFORM/usr/lib \
-L$PLATFORM/usr/lib \
-L$PREFIX/lib \
-soname libffmpeg.so -shared -nostdlib -Bsymbolic --whole-archive --no-undefined -o \
$PREFIX/libffmpeg.so \
libavcodec/libavcodec.a \
libavfilter/libavfilter.a \
libswresample/libswresample.a \
libavformat/libavformat.a \
libavutil/libavutil.a \
libswscale/libswscale.a \
libavdevice/libavdevice.a \
-lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker \
$TOOLCHAIN/lib/gcc/aarch64-linux-android/4.9.x/libgcc.a
}
build_one