How to compile latest FFmpeg Library for Android?

后端 未结 3 2026
情书的邮戳
情书的邮戳 2021-02-06 10:10

Struggling to put together a working and generally best practice build of current FFmpeg. There seems to be no up-to-date documents or tutorials. What does exist is full of outd

3条回答
  •  青春惊慌失措
    2021-02-06 10:35

    After reading so many post, I've managed to find the way to generate the ffmpeg library for an android

    Download below mentioned code and having it as ffmpeg.sh and execute the same in your ffmpeg source root folder and do make

    #!/bin/bash
    BASEDIR=$(pwd)
    TOOLCHAIN_PREFIX=/opt/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
    CFLAGS='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all'
    LDFLAGS='-Wl,-z,relro -Wl,-z,now -pie'
    
    ./configure \
    --target-os=linux \
    --cross-prefix=/opt/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi- \
    --arch=arm \
    --cpu=armv7-a \
    --enable-runtime-cpudetect \
    --sysroot=/opt/android-ndk-r9b/platforms/android-9/arch-arm/ \
    --enable-pic \
    --enable-pthreads \
    --enable-cross-compile \
    --disable-debug \
    --disable-ffserver \
    --enable-version3 \
    --enable-hardcoded-tables \
    --disable-ffplay \
    --disable-ffprobe \
    --enable-gpl \
    --enable-yasm \
    --disable-doc \
    --disable-shared \
    --enable-static \
    --extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \
    --extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS"
    

    Fore details, visit https://sites.google.com/site/greateindiaclub/mobil-apps/android/buildffmpegprebuiltlibraryforanandroid

提交回复
热议问题