您的位置:首页 > 移动开发 > IOS开发

ios编译ffmpeg

2015-04-17 17:22 246 查看
参考1:iMac下:http://blog.csdn.net/templar1000/article/details/8490838

参考2:linux下:http://www.oschina.net/question/54100_36528

参考3:iMac下:http://yarin.blog.51cto.com/1130898/862591

教你一招,一般下载的源码里面的configure文件很重要,但是经常会出现末尾都是 ^M,这样的,而且每行都是这样,只有用 vi -b configure 打开时可以看到,删掉就行,但是configure文件往往有上千行,不可能一行一行的删掉吧,那怎么办,用下面的办法: sed
-e 's/\r//' yourfile

相关文件:

下载 gas-preprocessor.pl

下载 ffmpeg2.2.6 点击打开链接

ffmpeg-build :

#!/bin/bash
rm -rf target
mkdir target
mkdir target/install

if [ $? -eq 0 ]; then
echo "creat target dir ok"
else
exit 0
fi

SOURCE_DIR=.
BUILD_DIR=$(pwd)/target
PLATFORM_ROOT="/Applications/Xcode.app/Contents/Developer"

echo "source dir is $SOURCE_DIR"
echo "build dir is $BUILD_DIR"
echo "cross platform root is $PLATFORM_ROOT"

#cp ${SOURCE_DIR}/configure  ${BUILD_DIR}/

#./configure
${SOURCE_DIR}/configure --disable-debug --enable-static --enable-version3 --enable-libx264 --enable-gpl --extra-cflags=-I./libx264 --extra-ldflags=-L./libx264 --enable-pthreads --enable-memalign-hack --enable-cross-compile --disable-network --enable-runtime-cpudetect --disable-doc --disable-asm  --enable-decoder=h264 --enable-encoder=libx264 --cc=${PLATFORM_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  --as='gas-preprocessor/gas-preprocessor.pl ${PLATFORM_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' --sysroot=${PLATFORM_ROOT}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk --extra-ldflags=-L${PLATFORM_ROOT}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/system  --target-os=darwin --arch=arm --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7'  --target-path=${BUILD_DIR}  --prefix=${BUILD_DIR} --tempprefix=${BUILD_DIR}/

if [ $? -eq 0 ]; then
echo "configure ok"
else
exit 0
fi

# make fat (universal) libs
make clean
make
if [ $? -eq 0 ]; then
echo "build success"
else
exit 0
fi

cp -f INSTALL.md  INSTALL
make install

if [ $? -eq 0 ]; then
echo "build install success"
else
exit 0
fi
echo "Done."
把这个复制到脚本文件里去。如果运行失败,提示/bin/bash ^M :no such file. 可以这样运行:vi -a ffmpeg-build,把里面的 ^M去掉,重新保存。

编译步骤:

1、 编译配置

1) 安装Xcode4 以上版本,并安装iPhoneOS SDK

2) 将gas-preprocessor.pl 复制到/usr/bin/下,并修改权限:sudo chmod a+rwx gas-preprocessor.pl

3) 修改ffmpeg-build文件。打开ffmpeg-build,检查PLATFORM_ROOT变量,修改其变量让它指向iPhoneOS sdk的目录。然后,将这个文件复制到代码源目录中

2、 编译

1) 将源代码复制到MAC OS中,进入目录,执行: ./ffmpeg-build 等待完成

2) 完成后,可以看到target/install目录,即编译成功。

使用例子:点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: