ffmpeg编译iOS静态库教程
来源:互联网 发布:彩超工作站软件 编辑:程序博客网 时间:2024/05/21 18:36
原文地址,直接进入正题了
本文大部分内容参考于此篇文章:How to Prepare Your Mac for iOS Development with FFmpeg Libraries , 然后针对最新情况做了一些修改。
1. 首先,准备编译环境
1. 安装Xcode和Command Line Tools2. 下载和安装 gas-preprocessor3. 安装 pkg-config
关于gas-preprocessor,安装方式是直接copy文件 gas-preprocessor.pl
到 /usr/bin
,记得修改权限可执行.
原文给出的下载地址是 gas-preprocessor , 不过这里的版本比较老 , 因为在编译ffmpeg的时候,gas-preprocessor版本必须和ffmpeg配合,所以如果你下载的ffmpeg源码是最新的,那么建议去 libav网站 下载最新的 gas-preprocessor.
如果之后在编译时候遇到类似这样的错误
unknown register alias 'TCOS_D0_HEAD'
那么可以尝试更换 gas-preprocessor版本来解决.
然后 pkg-config, 可以直接通过MacPorts来安装
sudo port install pkgconfig
2. 下载ffmpeg的源码
git clone git://source.ffmpeg.org/ffmpeg.git
3. 编译armv7的支持
configure参数如下
1
./configure --prefix=armv7 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" --extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=5.1" --extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=5.1" --arch=arm --cpu=cortex-a9 --enable-pic
编译和安装到armv7目录下
1
make clean && make && make install
4. 编译armv7s的支持
configure参数如下
1
./configure --prefix=armv7s --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" --extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=5.1" --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=5.1" --arch=arm --cpu=cortex-a9 --enable-pic
编译和安装到armv7s目录下
1
make clean && make && make install
5. 编译i386的支持
configure参数如下
1
./configure --prefix=i386 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" --extra-cflags="-arch i386" --extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" --arch=i386 --cpu=i386 --enable-pic --disable-asm
编译和安装到i386目录下
1
make clean && make && make install
如果一切顺利,那么ffmpeg目录下会分别生成 armv7、armv7s、i386几个目录,里面lib文件下就是我们需要的静态库了.
6. 最后,我们合并armv7、armv7s、i386库在一起.
1.建立universal/lib/
目录.
2.新建bash脚本,内容如下:
123456789101112
#! /bin/shcd armv7/libfor file in *.adocd ../..xcrun -sdk iphoneos lipo -output universal/lib/$file -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$fileecho "Universal $file created."cd -donecd ../..
3.执行这个脚本,稍等完成后在universal/lib/
下就是我们需要的静态库了。
以上这么简单的步骤就是编译ffmpeg为iOS静态库的方法,其他各种库编译方式也都大同小异.是不是很简单呢?
然后关于configure的参数,大家可以参考ffmepg官网解释
- ffmpeg编译iOS静态库教程
- 2016最新FFmpeg-iOS静态库编译
- mac系统编译 ffmpeg ios 静态库
- 编译 FFMPEG静态库
- 编译 ffmpeg 静态库
- iOS 编译ffmpeg静态库及常见问题处理
- ios ffmpeg编译支持命令行的静态库文件
- ios ffmpeg库 编译记录
- iOS下编译FFmpeg库
- ios 编译静态库
- ios 编译静态库
- ffmpeg编译的静态链接库问题
- ffmpeg编译的静态链接库问题
- ffmpeg编译的静态链接库问题
- MinGW编译ffmpeg的静态库
- MinGW编译ffmpeg的静态库
- MinGW编译ffmpeg的静态库
- Ubuntu下编译Ffmpeg静态库
- org.apache.commons.lang.StringUtil(StringUtil工具类的常用方法)
- poj 2369 Permutations (置换群)
- Java线程技术简介
- 将数字序列逆序输出(java)
- mysql 错误总结
- ffmpeg编译iOS静态库教程
- Agfa HealthCare releases next generation of its gold-standard
- Java数组操作的10大方法
- Maven环境的搭建&&Maven Eclipse插件的安装
- max_flow(Dinic)
- NotServingRegionException: Region is not online 错误总结
- 求小球落地5次后所经历的路程和第5次反弹的高度
- PL/SQL 记录集合IS TABLE OF的使用
- eclipse产生错误:Unable to execute dex: GC overhead limit exceeded