天天看點

How to fix build ffmpeg enable-jni error "jni not found", support for hard decoding

See configure file

enabled jni               && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads &&
                                check_lib "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }

           

You can see target_os must android.

#!/bin/bash  
NDK=~/android-ndk-r14b/
SYSROOT=$NDK/platforms/android-14/arch-arm/  
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64  
CPU=armv7-a
PREFIX=$(pwd)/$CPU  
ADDI_CFLAGS="-marm -march=$CPU"  

./configure \
    --prefix=$PREFIX \
    --enable-static \
    --disable-shared \
    --disable-ffserver \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-doc \
    --disable-symver \
    --enable-small \
    --enable-gpl \
    --enable-asm \
    --enable-jni \
    --enable-mediacodec \
    --enable-decoder=h264_mediacodec \
    --enable-hwaccel=h264_mediacodec \
    --enable-decoder=hevc_mediacodec \
    --enable-decoder=mpeg4_mediacodec \
    --enable-decoder=vp8_mediacodec \
    --enable-decoder=vp9_mediacodec \
    --enable-nonfree \
    --enable-version3 \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --target-os=android \
    --arch=arm \
    --sysroot=$SYSROOT \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG