How to compile latest FFmpeg Library for Android?

后端 未结 3 2027
情书的邮戳
情书的邮戳 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:31

    Build the standalone NDK Toolchain

    Download the latest NDK and run make_standalone_toolchain.py

    Configure FFmpeg

    ./configure \
    --cross-prefix=arm-linux-androideabi- \
    --sysroot="${ANDROID_STANDALONE_NDK}/sysroot" \
    --target-os=linux \
    --arch=arm \
    --cpu=cortex-a8 \
    --enable-cross-compile \
    --enable-pic \
    --enable-shared \
    --extra-cflags="-fpic"
    

    Then of course

    make -j4
    

    You probably don't want to compile a lot of the components, so you'll need to see what to enable/disable in ./configure --help

    0 讨论(0)
  • 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

    0 讨论(0)
  • 2021-02-06 10:56

    Solution found!

    Please check following links:

    • https://github.com/WritingMinds/ffmpeg-android
    • https://github.com/WritingMinds/ffmpeg-android-java
    • http://writingminds.github.io/ffmpeg-android/
    • http://writingminds.github.io/ffmpeg-android-java/
    0 讨论(0)
提交回复
热议问题