IOS5.0+ffmpeg+模拟器

本文提供了一份详细的FFmpeg iOS模拟器编译步骤,包括下载ffmpeg-iphone-build、配置环境变量、编译源码等,并针对常见问题如路径配置、旧版本编译错误提供了具体的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在转载的基础上增加了一些自己编译的问题:


编译ffmepg模拟器版本:
1. 到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build
2.先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。
3.到ffmpeg官网上下载ffmpeg源码
4.在终端下定位到ffmpeg的目录运行
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-avfilter --disable-debug --disable-encoders --enable-cross-compile --disable-decoders --disable-armv5te --enable-decoder=h264 --enable-pic --cc=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' --extra-ldflags=-L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/system --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk --target-os=darwin --arch=i386 --cpu=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386'
5.输入make命令
6.将libavcodec.a,libavdevice.a,libavformat.a,libavutil.a,libswscale.a到对应的目录下拷贝出来
7.在项目中就可以使用了。可以参考开源示例iFrameExtractor (git clone git://github.com/lajos/iFrameExtractor.git)需要将该项目的ffmpeg文件夹库替换为你编译的ffmpeg源码文件夹,然后在ffmpeg目录下新建lib目录,将刚刚拷贝出来的静态库拷贝进去。打开项目,添加libbz2.1.0.dylib系统库文件。点击编译运行就可以使用了。
8.注意如果使用的是ffmpeg0.8.5的库的话iFrameExtractor中的codec_type需要修改为AVMEDIA_TYPE_VIDEO。(下同)


以上是转载的。


我自己遇到的问题和解决方法如下:


1。更改sdk路径

比方说他的是“/Developer/Platforms/”而你的Developer文件夹放在哪就写哪,还有就是“/SDKs/iPhoneSimulator4.3.sdk”更改为相应的SDK“iPhoneSimulator5.0.sdk”

Config如下:

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-avfilter --disable-debug --disable-encoders --enable-cross-compile --disable-decoders --disable-armv5te --enable-decoder=h264 --enable-pic --cc=/Users/某某/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Users/某某/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' --extra-ldflags=-L/Users/某某/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/lib/system --sysroot=/Users/某某/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk --target-os=darwin --arch=i386 --cpu=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386'

2。要注意下载的FFMPEG源码版本,我开始下的版本有点老在xcode编译时出现了很多问题。


3。这时候编译出现

(1)CODEC_TYPE_VIDEO 未定义的话 改为AVMEDIA_TYPE_VIDEO

   (2) Undefined symbols for architecture i386:

  "_av_open_input_file", referenced from:

      -[VideoFrameExtractor initWithVideo:] in VideoFrameExtractor.o

那我们应该把

av_open_input_file(&pFormatCtx, [moviePathcStringUsingEncoding:NSASCIIStringEncoding],NULL, 0,NULL)!=0  改为

 avformat_open_input(&pFormatCtx, [moviePathcStringUsingEncoding:NSASCIIStringEncoding],NULL, NULL)!=0


运行OK!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值