做ios平台视频监控项目,需要视频解码,所以编译ffmpeg,首先说一下自己的开发环境:
mac os x 10.8.2
xcode 4.5
ios 6.0
ffmpeg 0.9.2
步骤如下:
第一:https://github.com/yuvi/gas-preprocessor下载gas-preprocessor.pl文件并将其放置到/usr/sbin路径下,然后对其赋予权限,如下所示
1:sudo cp gas-preprocessor.pl /usr/sbin 命令行到gas-preprocessor.pl 目录 ,拷贝
2:cd /usr/sbin
3:sudo chmod 777 gas-preprocessor.pl
第二:到ffmpeg的官网http://ffmpeg.org/download.html下载所需要版本代码,这里选择ffmpeg0.9.2,解压之后会得到一个ffmpeg-0.9.2的文件夹
第三:从终端进入到加压出来的ffmpeg-0.9.2文件夹,并执行make clean命令,清除上次生成的库文件
第四:模拟器
./configure \
--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \
--nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm" \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk \
--target-os=darwin \
--arch=i386 \
--cpu=i386 \
--extra-cflags='-arch i386 -miphoneos-version-min=4.3 -mdynamic-no-pic' \
--extra-ldflags='-arch i386 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' \
--prefix=compiled/i386 \
--enable-cross-compile \
--enable-nonfree \
--enable-gpl \
--disable-armv5te \
--disable-swscale-alpha \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-asm \
--disable-debug
第五:真机
make clean
./configure \
--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--as='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' \
--enable-pic \
--enable-cross-compile \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-doc
待续,参考http://www.cnblogs.com/kiss007/archive/2012/11/08/2760086.html