近期须要用到ffmpeg开发视频相关。在网上找了些编译资源,自己摸索着,总算编译ok了。

因此,记录下苦逼的编译过程,已祭奠我为之逝去的青春。

1、准备工作

首先。到ffmpeg官网下载最新到代码。

然后,https://github.com/lajos/iFrameExtractor 下载这个演示样例程序。并将里面的 gas-preprocessor.pl 复制到 /usr/local/bin 目录。

2、编译

首先。附上编译原文:

Build steps

  • Download the code using

git clone git://github.com/PinkyJie/iFrameExtractor.git

  • Download the latest ffmpeg (0.11.1 tested) using

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

  • Put the ffmpeg source code into the folder ffmpeg

  • Copy the perl script gas-preprocessor.pl into /usr/local/bin folder

  • Change directory to your ffmpeg folder, select
    your target platform and follow the scripts below

Platforms

  • armv7 (for iPhone 3GS and devices after 3GS)
configure

./configure \

--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \

--as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \

--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \

--target-os=darwin \

--arch=arm \

--cpu=cortex-a8 \

--extra-cflags='-arch armv7' \

--extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \

--prefix=compiled/armv7 \

--enable-cross-compile \

--enable-nonfree \

--enable-gpl \

--disable-armv5te \

--disable-swscale-alpha \

--disable-doc \

--disable-ffmpeg \

--disable-ffplay \

--disable-ffprobe \

--disable-ffserver \

--disable-asm \

--disable-debug

make

make clean

make && make install

  • armv6 (for devices before 3GS)
configure

./configure \

--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \

--as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \

--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \

--target-os=darwin \

--arch=arm \

--cpu=arm1176jzf-s \

--extra-cflags='-arch armv6' \

--extra-ldflags='-arch armv6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \

--prefix=compiled/armv6 \

--enable-cross-compile \

--enable-nonfree \

--enable-gpl \

--disable-armv5te \

--disable-swscale-alpha \

--disable-doc \

--disable-ffmpeg \

--disable-ffplay \

--disable-ffprobe \

--disable-ffserver \

--disable-asm \

--disable-debug

make

make clean

make && make install

  • i386 (for simulator)
configure

./configure \

--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \

--as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \

--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk \

--target-os=darwin \

--arch=i386 \

--cpu=i386 \

--extra-cflags='-arch i386' \

--extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk' \

--prefix=compiled/i386 \

--enable-cross-compile \

--enable-nonfree \

--enable-gpl \

--disable-armv5te \

--disable-swscale-alpha \

--disable-doc \

--disable-ffmpeg \

--disable-ffplay \

--disable-ffprobe \

--disable-ffserver \

--disable-asm \

--disable-debug

make

make clean

make && make install

  • universal (using one *.a files for all platforms)

mkdir -p ./compiled/fat/lib

lipo -output ./compiled/fat/lib/libavcodec.a -create \

-arch armv6 ./compiled/armv6/lib/libavcodec.a \

-arch armv7 ./compiled/armv7/lib/libavcodec.a \

-arch i386 ./compiled/i386/lib/libavcodec.a

lipo -output ./compiled/fat/lib/libavdevice.a -create \

-arch armv6 ./compiled/armv6/lib/libavdevice.a \

-arch armv7 ./compiled/armv7/lib/libavdevice.a \

-arch i386 ./compiled/i386/lib/libavdevice.a

lipo -output ./compiled/fat/lib/libavformat.a -create \

-arch armv6 ./compiled/armv6/lib/libavformat.a \

-arch armv7 ./compiled/armv7/lib/libavformat.a \

-arch i386 ./compiled/i386/lib/libavformat.a

lipo -output ./compiled/fat/lib/libavutil.a -create \

-arch armv6 ./compiled/armv6/lib/libavutil.a \

-arch armv7 ./compiled/armv7/lib/libavutil.a \

-arch i386 ./compiled/i386/lib/libavutil.a

lipo -output ./compiled/fat/lib/libswresample.a -create \

-arch armv6 ./compiled/armv6/lib/libswresample.a \

-arch armv7 ./compiled/armv7/lib/libswresample.a \

-arch i386 ./compiled/i386/lib/libswresample.a

lipo -output ./compiled/fat/lib/libpostproc.a -create \

-arch armv6 ./compiled/armv6/lib/libpostproc.a \

-arch armv7 ./compiled/armv7/lib/libpostproc.a \

-arch i386 ./compiled/i386/lib/libpostproc.a

lipo -output ./compiled/fat/lib/libswscale.a -create \

-arch armv6 ./compiled/armv6/lib/libswscale.a \

-arch armv7 ./compiled/armv7/lib/libswscale.a \

-arch i386 ./compiled/i386/lib/libswscale.a

lipo -output ./compiled/fat/lib/libavfilter.a -create \

-arch armv6 ./compiled/armv6/lib/libavfilter.a \

-arch armv7 ./compiled/armv7/lib/libavfilter.a \

-arch i386 ./compiled/i386/lib/libavfilter.a

The
complied static libraries (*.a) lie in theffmpeg/compiled folder.

我想编译armv7。

然后。发如今xcode6下。上述/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc

路径下根本没有gcc,于是找啊找。❤️在

/Applications/Xcode.app/Contents/Developer/usr/bin/gcc

找到了gcc。行啊,试试吧!

编译OK,顺利生成了。a文件。

3、将库复制到演示样例程序中。编译,出错。提示xxxxx undefined symbols for armv7

好吧,又苦苦百度了一遍。度娘没搭理我啊。

突然发现,生成的库文件还有个pkgconfig文件夹,里面找到那个提示文件libavcodec相关的libavcodec.pc文件。打开一看。没怎么看懂,里面有一行说:

Libs: -L${libdir}  -lavcodec -framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia -liconv -lm -lbz2 -lz -pthread

于是。我就在xcode的BuildSettings里面的other link flags里面增加了 -liconv。1⃣️居然好使。!。

4、我靠,就先这么着吧。

还望过路的大神们。不吝赐教不吝赐教。

macOS10.9+xcode6编译ffmpeg2.4.2 for ios的更多相关文章

  1. xcode6编译cocos2dx项目出现Undefined symbols _fwrite$UNIX2003

    当xcode6编译cocos2dx的时候会出现Undefined symbols _fwrite$UNIX2003 这个问题.google了一篇文章:http://stackoverflow.com/ ...

  2. 【FFMEPG】windows下编译ffmpeg2.5——使用VS2013,ARMLINUX,ANDORID编译ffmpeg

    原文:http://blog.csdn.net/finewind/article/details/42784557 一.准备: 1. 本机环境: win7 64bit: 2. 安装MinGW到C:\M ...

  3. cocos2d-x3.3 以前版本 工程Xcode6编译时的问题

    Undefined symbols for architecture i386: "_fwrite$UNIX2003", referenced from: _unixErrorHa ...

  4. 编译最新ffmpeg2.0.1到iOS设备

    www.mingjianhua.com 转载请注明出处. 上一篇文章讲了用NDKr9编译最新ffmpeg2.0.1到android平台,一般做了Android平台的编解码就免不了要做iOS,这次一起把 ...

  5. Windows(x64)编译FFMPEG-2.0.1

    一.引言 公司需要做网络视频传输的相关项目,初步选定用这么几个东西FFMPEG,ORTP,Live555这么几个东东.研究了也有一个月了,把一些心得写出来,这篇文章主要介绍FFMPEG在windows ...

  6. ubuntu11.04 编译ffmpeg2.7 并生成 ffplay进行流媒体測试

    源代码安装方式: 1. 先下载ffmpeg 安装包 到官网上 http://ffmpeg.org/download.html#releases 下载.选择Download gzip tarball. ...

  7. 手把手教你用NDK9编译ffmpeg2.4.2

    编译环境: 32位 ubuntu12.10 android-ndk-r9c-linux-x86.tar.bz2 ffmpeg-2.4.2.tar.bz2 网上的教程都是以低版本号ffmpeg编译居多. ...

  8. 用mingw32编译ffmpeg2.7

    1.  下载x265最新源码:      下载ffmpeg源码(我用的是2.7):      下载cmake最新版本并安装:      下载SDL(我用的SDL-1.2.15):      下载min ...

  9. Xcode6编译SDWebImage报错解决方法(SDWebImageDownloaderOperation.m错误)

    报错:Use of undeclared identifier '_executing' / '_finished': 解决方法: 在SDWebImageDownloaderOperation类的实现 ...

随机推荐

  1. oracle 创建命令

    环境变量设置(在Sqlplus中执行) create or replace directory filepath as 'D:\ORACLEBACKUP'; 备份脚本:expdp system/123 ...

  2. Mvc程序字体加载失败问题

    在我们开发的asp.net-mvc项目中,有时会出现字体加载失败的现象,但是一检查字体文件目录,发现文件目录都是存在的且有效的,这是为何呢?原来需要再web.config文件中添价少许配置代码就搞定. ...

  3. django模型层(二)

    多表操作 创建模型 实例:我们来假定下面这些概念,字段和关系 作者模型:一个作者有姓名和年龄. 作者详细模型:把作者的详情放到详情表,包含生日,手机号,家庭住址等信息.作者详情模型和作者模型之间是一对 ...

  4. spring事务回滚问题

    刚刚接到一个上家公司同事的一个电话,问我为什么service方法事务不会滚了,日志打印了,调用webservice报错. 我让他把这个调用执行webservice的方法截图发给我,如下:   publ ...

  5. [编码]ASCII、GBK、Unicode(万国码) 和 UTF-8

    American ASCII编码 (American Standard Code for Information Interchange,美国信息互换标准代码)  China    gbk编码     ...

  6. 2018年排名前20的数据科学Python库

    Python 在解决数据科学任务和挑战方面继续处于领先地位.业已证明最有帮助的Python库,我们选择 20 多个库,因为其中一些库是相互替代的,可以解决相同的问题.因此,我们将它们放在同一个分组. ...

  7. ArcGIS API For Android Errors汇总

    API客户端异常错误的发生通常是由于不正确的方法参数,对象状态依赖,或网络条件. //*******推荐使用方法,按下Ctrl+F搜索错误代码,再查看与代码对应的解释.********// ArcGI ...

  8. shiro登陆权限验证

    一>引入shirojar包 <!-- shiro登陆权限控制 -->        <dependency>            <groupId>org. ...

  9. python 上手

    1.安装模块 cmd---“pip install [模块名]” 2.爬虫常用模块 requests beautifulsoup4 3.检查已安装的模块 cmd ---"pip list&q ...

  10. C 语言复杂声明

    int board [8] [8] ; //声明一个内含 int 数组的数组 int ** ptr ; //声明一个指向指针的指针,被指向的指针指向 int int * risks [10] ; // ...