centos6.5下编译android平台使用的ffmpeg3.1动态库

搭建环境

centos6.5 + ffmpeg3.1

下载ndk

使用android-ndk-r10e-linux-x86_64.bin
[root@localhost zyl]# wget -c http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
google.com的网址需要,也可以直接从csdn下载一个来用

解压ndk工具包

[root@localhost zyl]# chmod +x ./android-ndk-r10e-linux-x86_64.bin && ./android-ndk-r10e-linux-x86_64.bin

配置ndk环境变量

[root@localhost android-ndk-r10e]# export PATH=$PATH:/home/zyl/android-ndk-r10e

查看ndk-build版本

[root@localhost zyl]# ndk-build -version
GNU Make 3.81

修改configure脚本

#注释掉configure脚本里面的
#SLIBNAME_WITH_MAJOR=’ ( S L I B N A M E ) . (SLIBNAME). (SLIBNAME).(LIBMAJOR)’
#LIB_INSTALL_EXTRA_CMD=’$ ( R A N L I B ) " (RANLIB) " (RANLIB)"(LIBDIR)/KaTeX parse error: Expected 'EOF', got '#' at position 13: (LIBNAME)"' #̲SLIB_INSTALL_NA…(SLIBNAME_WITH_VERSION)’
#SLIB_INSTALL_LINKS=’$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)’

#替换为下边的
SLIBNAME_WITH_MAJOR=’ ( S L I B P R E F ) (SLIBPREF) (SLIBPREF)(FULLNAME)- ( L I B M A J O R ) (LIBMAJOR) (LIBMAJOR)(SLIBSUF)’
LIB_INSTALL_EXTRA_CMD=’$ ( R A N L I B ) " (RANLIB) " (RANLIB)"(LIBDIR)/ ( L I B N A M E ) " ′ S L I B I N S T A L L N A M E = ′ (LIBNAME)"' SLIB_INSTALL_NAME=' (LIBNAME)"SLIBINSTALLNAME=(SLIBNAME_WITH_MAJOR)’
SLIB_INSTALL_LINKS=’$(SLIBNAME)’

重新配置ffmpeg,交叉编译

–prefix=/home/zyl/android-ffmpeg/ffmpeg-3.1.1/android/armeabi-v7a
–enable-shared
–disable-static
–enable-cross-compile
–cross-prefix=/home/zyl/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
–target-os=linux --arch=arm --sysroot=/home/zyl/android-ndk-r10e/platforms/android-19/arch-arm
–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 -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -std=c99’
–extra-ldflags=’ -Wl,-rpath-link=/home/zyl/android-ndk-r10e/platforms/android-14/arch-arm/usr/lib -L/home/zyl/android-ndk-r10e/platforms/android-14/arch-arm/usr/lib -Wl,–fix-cortex-a8 -lm -llog -lm -llog’
–extra-libs=’ -lgcc ’
–cpu=armv7-a --enable-neon
–enable-asm
–cc=/home/zyl/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
–nm=/home/zyl/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm

注:其他版本的ffmpg参数顺序可能需要调整一下,(如果不调整,可能会出现c compile fail之类的错误)

你可能感兴趣的:(#,安卓,#,流媒体,android,ffmpeg,cenos,交叉编译)