IOS,FFMPEG库编译以及iFrameExtractor DEMO总结

来源:互联网 发布:gta5 淘宝暗语 编辑:程序博客网 时间:2024/05/30 04:18

iFrameExtractor:https://github.com/lajos/iFrameExtractor.git

ffmpeg-iphone-build-master :https://github.com/gabriel/ffmpeg-iphone-build.git

ffmpeg:  git://source.ffmpeg.org/ffmpeg.git

在终端输入 git clone https://github.com/lajos/iFrameExtractor.git
然后再输入 git clone https://github.com/gabriel/ffmpeg-iphone-build.git
以及 git clone git://source.ffmpeg.org/ffmpeg.git


克隆下来,将ffmpeg文件夹放进ffmpeg-iphone-build目录下,并把文件夹名修改成ffmpeg-armv7


然后修改 build-armv7可执行文件(真机)     在 ./configure 修改成自己XCODE对应的路径   (XCODE5用下面这个行不通,会报错)

#!/bin/shtrap exit ERRFFMPEG_DIR=ffmpeg-armv7SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )echo "Pulling r22403..."cd $FFMPEG_DIRmkdir -p dist# Default configure optionsCONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter --disable-asm --enable-cross-compile"# Add x264 if existsX264_DIST="$SCRIPT_DIR/x264-armv7/dist"if [ -d "$X264_DIST" ]; then  CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libx264 --extra-ldflags=-L$X264_DIST/lib --extra-cflags=-I$X264_DIST/include"fi# Add xvid if existsXVID_DIST="$SCRIPT_DIR/xvid-armv7"if [ -d "$XVID_DIST" ]; then  CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libxvid --extra-ldflags=-L$XVID_DIST/lib --extra-cflags=-I$XVID_DIST/include"fiecho "Configure options: $CONFIGURE_OPTIONS"./configure --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as="$SCRIPT_DIR/gas-preprocessor.pl/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk --extra-cflags="-mdynamic-no-pic" --prefix="dist"$CONFIGURE_OPTIONS --target-os=darwin --arch=armv7 --cpu=armv7 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7'make && make installecho "Installed: $FFMPEG_DIR/dist"


解决 /usr/local/bin/ffmpeg: Permission denied的办法
用root帐户执行命令 
sudo -s
sudo -i
sudo su


在终端里执行以上操作后得出 几个静态库以及相关头文件

libavcodec.a、libavdevice.a、libvfilter.a、libavformat.a

libvutil.a、libwresamle.a、libwscale.a以及他们相关的头文件

(头文件不要直接添加到项目中)

将以上静态库加入项目Link Binary With Libraries中

另外请确保libiconv.dylib、libbz2.dylib、libz.dylib也在Link Binary With Libraries中


将 Build Settings中(注意)

Library Search Paths 添加 /Users/dale_hui/Music/FFMPEG_DemoByhui/FFMPEG_DemoByhui/ffmpeg/lib          这个路径就是你存放以上几个刚生成出来的路径

Header Search Paths 添加 /Users/dale_hui/Music/FFMPEG_DemoByhui/FFMPEG_DemoByhui/ffmpeg/include  这个路径就是刚才生成出头文件的路径


其次Archiectures 要 删掉 $(ARCHS_STANDARD_32_BIT)  添加armv6,armv7



著作权声明:本文由 http://blog.csdn.net/dalehui/ 原创,欢迎转载分享。请尊重作者劳动,转载时保留该声明和作者博客链接,谢谢!


原创粉丝点击