Android NDK FFMpeg编译配置

#!/bin/bash

# Global Value
export ANDROID_NDK_HOME=/data/ndk/android-ndk-r12b
export PLATFORM_VERSION=android-9

function build_ffmpeg
{
    echo "Start build FFmpeg $ARCH"
    ./configure --target-os=linux \
    --prefix=$PREFIX \
    --arch=$ARCH \
    --enable-shared \
    --enable-gpl \
    --enable-version3 \
    --enable-nonfree \
    --enable-postproc \
    --disable-static \
    --disable-yasm \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-doc \
    --enable-cross-compile \
    --cross-prefix=$CROSS_COMPILE \
    --sysroot=$PLATFORM \
    --extra-cflags="-fpic"
    make clean
    make
    make install

    echo "Build Finished $ARCH"
}

# arm
ARCH=arm
CPU=arm
PREFIX=$(pwd)/android/$CPU
TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
PLATFORM=$ANDROID_NDK_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH
build_ffmpeg

# x86
ARCH=x86
CPU=x86
PREFIX=$(pwd)/android/$CPU
TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/x86-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/i686-linux-android-
PLATFORM=$ANDROID_NDK_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH
build_ffmpeg

#!/bin/bash
export NDK=/usr/ndk/android-ndk-r10e
export SYSROOT=$NDK/platforms/android-9/arch-arm/
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export CPU=arm
export PREFIX=$(pwd)/android/$CPU
export ADDI_CFLAGS="-marm"

./configure --target-os=linux \
--prefix=$PREFIX --arch=arm \
--disable-doc \
--enable-shared \
--disable-static \
--disable-yasm \
--disable-symver \
--enable-gpl \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
#!/bin/bash

#全局变量,多个shell脚本都可以使用
export ANDROID_NDK_HOME=/usr/ndk/android-ndk-r10e
export PLATFORM_VERSION=android-9

function build_ffmpeg
{
    echo "start build ffmpeg $ARCH"
    ./configure --target-os=linux \
    --prefix=$PREFIX \
    --arch=$ARCH \
    --enable-shared \
    --disable-static \
    --disable-yasm \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-doc \
    --enable-cross-compile \
    --cross-prefix=$CROSS_COMPILE \
    --sysroot=$PLATFORM \
    --extra-cflags="-fpic"
    make clean
    make
    make install

    echo "build finished $ARCH"
}

#exec 1>jason_build_stdout.txt
#exec 2>jason_build_stdout.txt
#arm
ARCH=arm
CPU=arm
PREFIX=$(pwd)/android/$CPU
TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
PLATFORM=$ANDROID_NKD_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH
build_ffmpeg

#x86
ARCH=x86
CPU=x86
PREFIX=$(pwd)/android/$CPU
TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/x86-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/i686-linux-android-
PLATFORM=$ANDROID_NKD_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH
build_ffmpeg

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/12/android-ndk-ffmpeg-compilation-configuration/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
Android NDK FFMpeg编译配置
#!/bin/bash # Global Value export ANDROID_NDK_HOME=/data/ndk/android-ndk-r12b export PLATFORM_VERSION=android-9 function build_ffmpeg { echo &……
<<上一篇
下一篇>>
文章目录
关闭
目 录