FFMPEG 1.0 ANDROID NDK R8B

后端 未结 1 1256
我在风中等你
我在风中等你 2021-01-13 15:48

I have tried to compile the last version of ffmpeg with the android ndk r8b, but i always have errors and i dont know how to solve them. I am reading this tutorial http://ww

相关标签:
1条回答
  • 2021-01-13 16:23

    After many hour of work i have find one way to compile it:

    1) give permissions "chmod 777 ./* -R" in the folder that contains android-ndk and ffmpeg in my case (Be sure to use './' and not '/'!)
    2) install things that i need in my environment.
    3) this is my new .sh file

    function build_r8b_test
    {
    bash configure --target-os=linux \
    --prefix=$PREFIX \
    --enable-cross-compile \
    --extra-libs="-lgcc" \
    --arch=arm \
    --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
    --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
    --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
    --sysroot=$PLATFORM \
    --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
    --disable-shared \
    --enable-static \
    --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
    --disable-everything \
    --enable-demuxer=mov \
    --enable-demuxer=h264 \
    --disable-ffplay \
    --enable-protocol=file \
    --enable-avformat \
    --enable-avcodec \
    --enable-decoder=rawvideo \
    --enable-decoder=mjpeg \
    --enable-decoder=h263 \
    --enable-decoder=mpeg4 \
    --enable-decoder=h264 \
    --enable-parser=h264 \
    --enable-encoder=mpeg4 \
    --enable-encoder=mpeg \
    --disable-network \
    --enable-zlib \
    --disable-avfilter \
    --disable-avdevice \
    $ADDITIONAL_CONFIGURE_FLAG
    sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h
    sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h
    sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h
    sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h
    sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h
    sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h
    make clean
    make  -j4 install
    $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
    $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog  --warn-once  --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
    }
    
    #arm v7vfpv3
    CPU=armv7-a
    OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
    PREFIX=./android/$CPU
    ADDITIONAL_CONFIGURE_FLAG=
    build_r8b_test
    
    0 讨论(0)
提交回复
热议问题