在ubantu上编译ffmpeg

ndk是15r,ffmpeg是3.2.10

编译出各个库的so文件,xxx是本地的路径,sh脚本如下:

export TMPDIR=/home/xxx/e/ffmpeg-3.2.10/ffmpegtemp

NDK=/home/xxx/e/android-ndk-r15c

SYSROOT=$NDK/platforms/android-14/arch-arm

TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

function build_one(){

./configure \

    --prefix=$PREFIX \

    --enable-shared \

    --disable-static \

    --disable-doc \

    --disable-ffmpeg \

    --disable-ffplay \

    --disable-ffprobe \

    --disable-ffserver \

    --disable-avdevice \

    --disable-doc \

    --disable-symver \

    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \

    --target-os=linux \

    --arch=arm \

    --enable-cross-compile \

    --sysroot=$SYSROOT \

    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \

$ADDITIONAL_CONFIGURE_FLAG

}

CPU=arm

PREFIX=$(pwd)/android/$CPU

ADDI_CFLAGS="-marm"

make clean

make -j8

sudo make install

build_one



注意:记得给命令脚本赋权限:chmod 777 build-armv7.sh

需要修改configure  vi configure   大概在3247行左右的地方

将:

SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'

LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'

SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'

SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'

修改为:

SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'

LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'

SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'

SLIB_INSTALL_LINKS='$(SLIBNAME)'

你可能感兴趣的:(在ubantu上编译ffmpeg)