先声明下:一直想做视频方面的东东,公司不给这个机会。只要忙完工作任务之余自己学习。
回到正题
1。先下载两个东东
iFrameExractor git://github.com/lajos/iFrameExtractor.git
ffmpeg git://source.ffmpeg.org/ffmpeg.git 这个最新到1.0
说明下,开始学习的时候看网上都是给 git clone git://github.com/lajos/iFrameExtractor.git 的地址。这个地址搞的郁闷死了,首先不懂git是啥东西,在浏览器上粘贴地址并回车没有反应(火狐上),在终端输入执行后,提示git no find。没有办法,学习git(哥没有搞过linux下的东东)。在还不明白git的怎么回事的时候,无意在Safari上粘贴地址并回车。有反应了。原来把git clone取消复制后面的地址就可以。 擦擦擦。
记得把ffmpeg文件夹放到iFrameExractor中。。
2。下载ffmpeg-iphone-build(网址:https://nodeload.github.com/gabriel/ffmpeg-iphone-build/zip/master)
拷贝gas-preprocessor.pl到/usr/local/bin
说明:这个下载比上个下载就简单多了(哥不熟悉git)
3。在终端下: cd /iFrameExtractor/ffmpeg 建议开始就执行 sudo -s (获取权限命令)
4。在终端下输入 ./configure --prefix=/iFrameExtractor/ffmpeg --libdir=iFrameExtractor/ffmpeg/lib --enable-gpl --enable-static --disable-shared --enable-swscale --enable-zlib --enable-bzlib --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pthreads
5。执行make 这里会有一堆的编译情况。看到这些编译,心里踏实了(因为至少在做事情)
最好先升级Command Line Tools 。方法:Xcode/Preferences/Downloads/Components 安装Command Line Tools
6。执行make install。 (执行完后 到iFrameExtractor/ffmpeg/lib文件上去看看)
出现了 libavcodec libavdevice libavformat libavutil libswscale5个.a文件.终于出来了。
用xcode 打开iFrameExractor工程,确认Header Search Paths里有:"$(SRCROOT)/ffmpeg"路径。 $(SRCROOT)表示工程路径。同时可以看到iFrameExractor工程下ffmpeg文件下的.a文件都不是红色的了。
真机上编译(模拟器上i386,真机上是arm的,真机还分arm6 和arm7 ) 以下是针对arm7的
7。 ./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' -- sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk' --enable-pic
8。执行 make 和make install 就有上面的几个.a文件。 ok