环境:xcode4.6,IOS6.1 macos 10.7.4
1. 到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build
2.先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。3.到这里下载最新的 ffmpeg: http://ffmpeg.org/download.html 或者命令行安装:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
下载一个事例工程:git clone git://github.com/lajos/iFrameExtractor.git
4.然后到命令行下到ffmpeg的目次下,履行:
./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.1.sdk \
--extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.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 \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-asm \
--disable-encoders \
--disable-decoders \
--enable-decoder=h264 \
--disable-doc
5.履行sudo make,若是给代码做了批改,就先sudo make clean
6.履行sudo make install
7 运行iFrameExtractor
在你的工程根目次下创建一个叫ffmpeg的文件夹,把/usr/local/lib和/usr/local/include放进去
工程中设置header search path :"$SRCROOT)/ffmpeg/include",library search path:"$(SRCROOT)/ffmpeg/lib"
成功运行截图 运行环境 iphone5 ios6.1
因为是armv7 的库, 所以需要将 Build Settings 里 Valid Architectures 改为armv7