在ios上使用ffmpeg

本文详细介绍了一种在iOS 4.3系统上编译FFmpeg的方法,包括配置环境、解决常见错误及所需工具的安装步骤。适用于希望在iOS平台上进行多媒体开发的读者。

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


最近要使用ffmpeg,找了些编译教程.又自己鼓捣的几天.现在终于可以编译出来了.

现在主要用的ios系统是4.3.我先把编译文件放出来


#!/bin/tcsh -f


if (! -d armv7) mkdir armv7
if (! -d lib) mkdir lib


rm armv7/*.a


make clean


./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic


make


mv libavcodec/libavcodec.a armv7/
mv libavdevice/libavdevice.a armv7/
mv libavformat/libavformat.a armv7/
mv libavutil/libavutil.a armv7/
mv libswscale/libswscale.a armv7/


rm lib/*.a


cp armv7/*.a lib/



上述编译文件由从https://github.com/lajos/iFrameExtractor,中搞出来的.


注意事项:

1.如果直接使用iFrameExtractor,就不需要拷贝gas-preprocessor.pl 到/usr/local/bin文件夹和/usr/sbin文件夹下了.

(需要说明的一点,gas-preprocessor.pl 要和ffmpeg的版本匹配,要不会提示无法configuer的)

2.出错,提示:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file.
C compiler test failed.

修改为

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk' --enable-pic

(添加这个参数-isysroot.当第一次添加完以后.以后的编译就不需要了.)

3.我尝试了,使用最新的ffmpeg和gas-preprocessor.pl来进行编译..使用没有添加-isysroot的编译命令.是可以编译通过的.但是使用iFrameExtractor里自带的ffmpeg就会提示.上面第2个情况.

4.

编译的时候遇到错误:

ERROR: .endm without .macro at /usr/local/bin/gas-preprocessor.pl line 83, <ASMFILE> line 55

用老版本的libavcodec/arm/asm.S和libavcoec/arm/dsputil_arm.S覆盖新版本(实际上我怀疑只覆盖asm.S即可),重新编译即可.

5.

第一次编译ffmpeg的时候会遇到GNU assembler not found, install gas-preprocessor错误提示

意思就是让我们安装gas-preprocessor啦

安装步骤

1)到https://github.com/yuvi/gas-preprocessor下载gas-preprocessor安装包

2)解压安装包

3)复制gas-preprocessor.pl到/usr/local/bin下

4)chmod 777 /usr/local/bin/gas-preprocessor.pl



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值