android- How to compile ffmpeg for all cpu archite

2020-07-17 05:19发布

问题:

How to compile ffmpeg for all cpu architectures in android. Currently i'm using the following script which generates libs for arm only.

#!/bin/bash
NDK=$HOME/ndk32
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86
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

I want to support all possible platforms.

回答1:

Just use different toolchains, see build_android.sh from AndroidFFmpeg project as a good example. Note that it handles library for ARM NEON SIMD as well, it is loaded at run-time if NEON support is detected.