大家好,又见面了,我是你们的朋友全栈君。
1.下载ffmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
2.下载gas-preprocessor
地址: https://github.com/yuvi/gas-preprocessor
下载完后把gas-preprocessor.pl 复制到 /usr/bin/ 目录下,修改权限 chmod 777
3.解压ffmpeg,并进入ffmpeg文件夹:
a.编译armv7
./configure –cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc –as=’/usr/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc’ –sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk –extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system –target-os=darwin –arch=arm –cpu=cortex-a8 –extra-cflags=’-arch armv7′ –extra-ldflags=’-arch armv7′ –extra-cflags=’-mfpu=neon’ –extra-cflags=’-mfloat-abi=softfp’ –enable-pic –enable-cross-compile –enable-ffmpeg –enable-decoder=h264 –disable-doc
b.编译完后,make , sudo make install
c.可以在/usr/local/目录下看到lib inlucde文件夹都有新增文件,将/usr/local/lib/下的.a文件复制到随便新建一个文件夹,命名文件夹armv7
4.编译armv7s
a. ./configure –disable-doc –disable-ffmpeg –disable-ffplay –disable-ffserver –enable-cross-compile –arch=arm –target-os=darwin –cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc –as=’gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc’ –sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk –cpu=cortex-a8 –extra-cflags=’-arch armv7s’ –extra-ldflags=’-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk’ –enable-pic –enable-decoder=rawvideo –disable-asm
b.编译完后,make , sudo make install
c.可以在/usr/local/目录下看到lib inlucde文件夹都有新增文件,将/usr/local/lib/下的.a文件复制到随便新建一个文件夹,命名文件夹armv7s
5.合并两个版本
a.去掉重复的log2_tab.o
ar -dv armv7s/libavutil.a log2_tab.o
ar -dv armv7/libavutil.a log2_tab.o
ar -dv armv7s/libswresample.a log2_tab.o
ar -dv armv7/libswresample.a log2_tab.o
ar -dv armv7s/libavformat.a log2_tab.o
ar -dv armv7/libavformat.a log2_tab.o
b.合并
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavcodec.a -arch armv7s armv7s/libavcodec.a -output libavcodec.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavdevice.a -arch armv7s armv7s/libavdevice.a -output libavdevice.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavfilter.a -arch armv7s armv7s/libavfilter.a -output libavfilter.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavformat.a -arch armv7s armv7s/libavformat.a -output libavformat.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavutil.a -arch armv7s armv7s/libavutil.a -output libavutil.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libswresample.a -arch armv7s armv7s/libswresample.a -output libswresample.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libswscale.a -arch armv7s armv7s/libswscale.a -output libswscale.a
6.添加到xcode
新建文件夹ffmpeg,将合并后的.a文件和/usr/local/include/*的文件复制到ffmpeg夹下,把ffmpeg复制到工程下,并add
7.在工程的build phase引入libz.dylib和libbz2.dylib两个库
8.在Build Settings, 搜索header search paths, 加上ffmpeg
编译运行。。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/127466.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...