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

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/sh

trap exit ERR



FFMPEG_DIR=ffmpeg-armv7
SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )

echo "Pulling r22403..."


cd $FFMPEG_DIR
mkdir -p dist

# Default configure options
CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter --disable-asm --enable-cross-compile"

# Add x264 if exists
X264_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 exists
XVID_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"
fi

echo "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 install

echo "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/ 原创,欢迎转载分享。请尊重作者劳动,转载时保留该声明和作者博客链接,谢谢!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值