编译环境
- Ubuntu
- FFmpeg-4.3.1
- android-ndk-r21b
修改FFmpeg-4.3.1下的configure文件
修改前
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)'
添加编译脚本 build_android.sh
- 对应脚本
#!/bin/bash
PREFIX=/home/it/ffmpeg-4.3.1/android/armeabi-v7a
TOOLCHAIN=/home/it/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64
build()
{
./configure \
--prefix=$PREFIX \
--disable-static \
--enable-shared \
--enable-small \
--enable-gpl \
--disable-doc \
--disable-programs \
--disable-avdevice \
--enable-cross-compile \
--target-os=android \
--arch=armeabi-v7a \
--cc=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi-
sudo make clean
sudo make -j4
sudo make install
}
build
编译命令
./android_build.sh