ffmpeg 编译IOS静态库
我使用的配置:xcode4.5,IOS6.0,ipad 1(4.3)
一、准备资源
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
二、编译
4.然后到命令行下到ffmpeg的目录下,执行:
下面的命令中,在mac10.8系统下把/Developer/Platforms/iPhoneOS.platform/这样的路径替换成/Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/,也就是xcode安装路径。
./configure \
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \
--sysroot=/Applications/Xcode4_4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \
--extra-ldflags=-L/Applications/Xcode4_4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.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-doc \
--disable-encoders \
--disable-debug
//
./configure --cc=/Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor.pl /Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk --extra-ldflags=-L/Applications/Xcode4_5.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 --enable-ffmpeg --disable-ffplay --disable-ffserver --disable-asm --disable-doc --disable-encoders
//精简
./configure --cc=/Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor.pl /Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Applications/Xcode4_5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk --extra-ldflags=-L/Applications/Xcode4_5.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-cross-compile --disable-pic --disable-encoders --disable-decoders --disable-muxers --disable-demuxers --disable-debug --disable-doc --disable-asm --disable-ffserver --disable-ffplay --disable-avfilter --disable-avdevice --enable-decoder=mpeg4 --enable-decoder=aac --enable-decoder=h264 --enable-demuxer=mpegvideo --enable-demuxer=mov
5.执行sudo make,如果给代码做了修改,就先sudo make clean
6.执行sudo make install
三、使用
7.在你的工程根目录下创建一个叫ffmpeg的文件夹,把/usr/local/lib和/usr/local/include放进去
8.工程中设置header search path :"$(SRCROOT)/ffmpeg/include",library search path:"$(SRCROOT)/ffmpeg/lib"
9.添加libbz2.1.0和libz.1.2.5引用
网上实例:https://github.com/lajos/iFrameExtractor