两个库文件下载地址
1.将两个库文件下载到同一个目录
2.编译 libx264
在libx264文件夹下新建一个 XX.sh
将以下代码拷贝到xx.sh 内 请不要修改
#!/bin/sh
DEST=../iOS/video/iOS
VERSION="6.1"
SDK_VERSION="6.1"
DEVPATH=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
#DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer
echo "Building armv7..."
export CC=${DEVPATH}/usr/bin/llvm-gcc
./configure --host=arm-apple-darwin \
--sysroot=${DEVPATH}/SDKs/iPhoneOS${VERSION}.sdk \
--prefix=$DEST \
--extra-cflags='-arch armv7' \
--extra-ldflags="-L${DEVPATH}/SDKs/iPhoneOS${SDK_VERSION}.sdk/usr/lib/system -arch armv7" \
--enable-pic \
--enable-static
make && make install
echo "Installed: $DEST"
命令行进入 libx264
执行 sh xx.sh
3.编译 ffmpeg
在ffmpeg文件夹下新建一个 xx2.sh
将以下代码拷贝到xx2.sh 内 请不要修改
#!/bin/sh
DEST=../iOS/video/iOS
VERSION=6.1
IPHONEOS_DEPLOYMENT_TARGET=6.1
DEVPATH=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
#DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer
X264INCLUDE=${DEST}/include
X264LIB=${DEST}/lib
COMMONFLAGS="-miphoneos-version-min=$IPHONEOS_DEPLOYMENT_TARGET -arch armv7 "
CFLAGS="$CFLAGS $COMMONFLAGS -I$X264INCLUDE"
LDFLAGS="$LDFLAGS -L${DEVPATH}/SDKs/iPhoneOS${VERSION}.sdk/usr/lib/system $COMMONFLAGS -L$X264LIB"
export CC=${DEVPATH}/usr/bin/llvm-gcc
export RANLIB=${DEVPATH}/usr/bin/ranlib
echo "Building armv7..."
./configure \
--cpu=cortex-a8 \
--extra-cflags="$CFLAGS" \
--extra-ldflags="$LDFLAGS" \
--enable-cross-compile \
--arch=arm \
--target-os=darwin \
--cc=${CC} \
--sysroot=${DEVPATH}/SDKs/iPhoneOS${VERSION}.sdk \
--prefix=${DEST} \
--enable-gpl \
--disable-network \
--disable-decoders \
--disable-muxers \
--disable-demuxers \
--disable-devices \
--disable-parsers \
--disable-encoders \
--disable-protocols \
--disable-filters \
--disable-bsfs \
--enable-libx264 \
--enable-encoder=libx264 \
--enable-encoder=libx264rgb \
--enable-decoder=h264 \
--enable-encoder=h263 \
--enable-decoder=h263 \
--enable-gpl \
--enable-pic \
--disable-doc \
--disable-ffplay \
--disable-ffprobe
make & make install
echo "Installed: $DEST"
命令行进入 ffmpeg
执行 sh xx2.sh
编译好的库在两个库原文件所在同级目录
iOS/video/iOS 下