Xcode5编译ffmpeg
命令行安装FFmpeg:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg(或:到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build)
安装命令行工具(Command Line Tools)
打开终端,输入命令:xcode-select --install
选择“安装”,然后同意安装协议。
下载gas-preprocessor:https://github.com/mansr/gas-preprocessor, 先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。
然后修改gas-preprocessor.pl文件的权限。注:需要有读,写和执行的权限。具体操作为,首先在命令行下进入/usr/bin目录,然后执行chmod命令,如下图所示:
运行build-ffmpeg.sh文件:
1、cd /build-ffmpeg.sh 脚本的所在目录下
2、sh build-ffmpeg.sh
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION=
"2.0.2"
SDKVERSION=
"7.0"
#
#
###########################################################################
#
# Don't change anything under
this
line!
#
###########################################################################
# No need to change
this
since xcode build will only compile
in
the
# necessary bits from the libraries we create
ARCHS=
"armv7 armv7s i386"
DEVELOPER=`xcode-select -print-path`
cd
"`dirname \"$0\"`"
REPOROOT=$(pwd)
# Where we'll end up storing things
in
the end
OUTPUTDIR=
"${REPOROOT}/dependencies"
mkdir -p ${OUTPUTDIR}/
include
mkdir -p ${OUTPUTDIR}/lib
mkdir -p ${OUTPUTDIR}/bin
BUILDDIR=
"${REPOROOT}/build"
mkdir -p $BUILDDIR
# where we will keep our sources and build from.
SRCDIR=
"${BUILDDIR}/src"
mkdir -p $SRCDIR
# where we will store intermediary builds
INTERDIR=
"${BUILDDIR}/built"
mkdir -p $INTERDIR
########################################
cd $SRCDIR
# Exit the script
if
an error happens
set
-e
if
[ ! -e
"${SRCDIR}/ffmpeg-${VERSION}.tar.bz2"
]; then
echo
"Downloading ffmpeg-${VERSION}.tar.bz2"
curl -LO http:
//ffmpeg.org/releases/ffmpeg-${VERSION}.tar.bz2
else
echo
"Using ffmpeg-${VERSION}.tar.bz2"
fi
tar jxf ffmpeg-${VERSION}.tar.bz2 -C $SRCDIR
cd
"${SRCDIR}/ffmpeg-${VERSION}"
set
+e # don
't bail out of bash script if ccache doesn'
t exist
CCACHE=`which ccache`
if
[ $? ==
"0"
]; then
echo
"Building with ccache: $CCACHE"
CCACHE=
"${CCACHE} "
else
echo
"Building without ccache"
CCACHE=
""
fi
set
-e # back to regular
"bail out on error"
mode
for
ARCH
in
${ARCHS}
do
if
[
"${ARCH}"
==
"i386"
];
then
PLATFORM=
"iPhoneSimulator"
EXTRA_CONFIG=
"--arch=i386 --disable-asm --enable-cross-compile --target-os=darwin --cpu=i386"
EXTRA_CFLAGS=
"-arch i386"
EXTRA_LDFLAGS=
"-I${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk/usr/lib -mfpu=neon"
else
PLATFORM=
"iPhoneOS"
EXTRA_CONFIG=
"--arch=arm --target-os=darwin --enable-cross-compile --cpu=cortex-a9 --disable-armv5te"
EXTRA_CFLAGS=
"-w -arch ${ARCH} -mfpu=neon"
EXTRA_LDFLAGS=
"-mfpu=neon"
fi
mkdir -p
"${INTERDIR}/${ARCH}"
./configure --prefix=
"${INTERDIR}/${ARCH}"
--disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-iconv --disable-bzlib --enable-avresample --sysroot=
"${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
--cc=
"${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
--
as
=
'/usr/local/bin/gas-preprocessor.pl'
--extra-cflags=
"${EXTRA_CFLAGS} -miphoneos-version-min=${SDKVERSION} -I${OUTPUTDIR}/include"
--extra-ldflags=
"-arch ${ARCH} ${EXTRA_LDFLAGS} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk -miphoneos-version-min=${SDKVERSION} -L${OUTPUTDIR}/lib"
${EXTRA_CONFIG} --enable-pic --extra-cxxflags=
"$CPPFLAGS -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
make && make install && make clean
done
mkdir -p
"${INTERDIR}/universal/lib"
cd
"${INTERDIR}/armv7/lib"
for
file
in
*.a
do
cd ${INTERDIR}
xcrun -sdk iphoneos lipo -output universal/lib/$file -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$file
echo
"Universal $file created."
done
cp -r ${INTERDIR}/armv7/
include
${INTERDIR}/universal/
echo
"Done."
把/build/built/universal目录下的 lib 和 include 文件导入工程,并在header search path 配置 include文件 路径。
本文出自 “追逐风飞的花” 博客,请务必保留此出处http://metoo.blog.51cto.com/7809119/1382158
Xcode5编译ffmpeg的更多相关文章
- XCode5 编译ffmpeg流程
今天想在Mac10.9 XCode5的环境下把ffmpeg编译出来,本来以为很好搞定,结果版本一升级,以前的命令行不通了,出各种错误.折腾了三四个小时,最后终于成功了. 编译流程: 1.ffmpeg官 ...
- Xcode5 编译ffmpeg,arm64版本;H264
编译选项:./configure —-cc=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchai ...
- Xcode编译ffmpeg(2)
iOS: FFmpeg编译和使用问题总结 折磨了我近一周多时间的FFmpeg库编译问题终于解决了,必须得把这一段时间来遇到过的坑全写出来.如果急着解决问题,编译最新版本的FFmpeg库请直接看第二部分 ...
- iOS编译FFmpeg、kxmovie实现视频播放 (转载)
由于FFmpeg开源框架的功能非常强大,可以播放的视频种类很多,同时添加第三方库kxmovie,实现视频播放,真的是爽爆了,因此今天来说一下关于FFmpeg在iOS手机上的一些配置过程,配置工具,还有 ...
- 编译FFmpeg成一个SO库<转>
转帖地址:http://www.ihubin.com/blog/android-ffmpeg-demo-3/ ============================================= ...
- Linux下NDK编译FFMPEG包含neon参数
FFMPEG编译成Android库已经有很多案例了,编译优化neon的也很多,以下是我通过实践成功的案例,这里主要讲编译的配置文件,其他设置可结合Linux下使用NDK编译FFMPEG(libstag ...
- [原]如何用Android NDK编译FFmpeg
我们知道在Ubuntu下直接编译FFmpeg是很简单的,主要是先执行./configure,接着执行make命令来编译,完了紧接着执行make install执行安装.那么如何使用Android的ND ...
- 在Windows下利用MinGW编译FFmpeg
目录 [隐藏] 1 环境与软件 2 第一步:安装MinGW 3 第二步:配置编译环境 4 第三步:配置SDL 5 第四步:编译 5.1 编译faac 5.2 编译fdk-aac 5.3 编译x264 ...
- 开源项目:windows下使用MinGW+msys编译ffmpeg
本文参考了网络上的不少文章,但由于版本环境的问题参考文章并不能直接指导编译,本文吸收多方经验,并在自己多次编译实验的基础上写成,欢迎转载,请注名出处. FFmpeg是在Linux平台下开发的,但 ...
随机推荐
- [翻译角]Learn From George, Not Pinocchio(ESLPOD)
以下转自www.eslpod.com,翻译为本人添加.其余版权均归原网站所有. ESLPOD是一个英语学习网站,我最初知道这个网站,是因为“奶爸”<把你的英语用起来>一书的推荐. ESLP ...
- vim升级到8.0
1.卸载 sudo apt-get remove --purge vim 2.添加8.0的vim源并安装 sudo add-apt-repository ppa:jonathonf/vim sudo ...
- iOS开发个人开发账号的证书详细使用及介绍
本人也和大家一样在学习iOS的开发,在开发当中最烦的就是证书出问题,主要是没有理解透证书的含义,因此查阅了一些资料,才对证书有了一定的认识,本文章就是介绍个人的个人理解,有不对的地方大加可以留言提醒, ...
- windows下mongodb设置用户名密码&用python连接
环境: 主机:WIN10 python版本:3.5 mongodb版本:3.4.2 开发环境:pyCharm mongodb设置用户名密码: 编写mongodb配置文件mongodb.confdbpa ...
- 转贴:CSS伪类与CSS伪元素的区别及由来具体说明
关于两者的区别,其实是很古老的问题.但是时至今日,由于各种网络误传以及一些不负责任的书籍误笔,仍然有相当多的人将伪类与伪元素混为一谈,甚至不乏很多CSS老手.早些年刚入行的时候,我自己也被深深误导,因 ...
- .NET Runtime version 2.0.50727.8762 - 执行引擎错误(7969097A) (80131506)
VS2010调试IIS发布的web工程提示:无法连接到 Visual Studio 开发服务器 .NET Runtime version 2.0.50727.8762 - 执行引擎错误(7969097 ...
- CodeForces 515C Drazil and Factorial (水题)
题意:给出含有 n 个只有阿拉伯数字的字符串a,设定函数F(a) = 每个数字的阶乘乘积 .需要找出 x,使得F(x) = F(a),且组成 x 的数字中没有0和1.求最大的 x 为多少. 析:最大, ...
- codemirror插件-文件比较组件merge
目的: 为了实现文件比较功能 引用文件 从github下载项目后,从以下路径引用文件,其中部分github分支中codemirror.js 需要运行项目,自动合成 <link rel=style ...
- C# 自动批量导入图片到数据库中
using Model; using System; using System.Collections.Generic; using System.Data; using System.Data.Sq ...
- Storm编程入门API系列之Storm的可靠性的ACK消息确认机制
概念,见博客 Storm概念学习系列之storm的可靠性 什么业务场景需要storm可靠性的ACK确认机制? 答:想要保住数据不丢,或者保住数据总是被处理.即若没被处理的,得让我们知道. publi ...