iphone - 为 iOS6.0 ARMv7 处理器构建 FFMPEG 库

标签 iphone gcc ffmpeg ios6 armv7

警告:

另一位用户刚刚告诉我,在 iOS 上使用 FFMPEG 存在一些法律问题,请在此处留下链接 http://multinc.com/2009/08/24/compatibility-between-the-iphone-app-store-and-the-lgpl/

当我第一次写它时,我很慌张,我稍微清理了一下我的问题。现在稍微休息一下我就能更清楚了。

Edit: learned that you have to build for ARMv7, ARMv7s and iOS6.0

我正在尝试在 XCode 4.5.1 项目中使用 FFMPEG 库。我正在尝试为 ARMv7 构建它。我正在寻找的是确切的过程和一些解释。我知道这不是一个有据可查的问题。但我知道其他人也有和我一样的问题。

我能做什么。

我已经能够构建用于测试的库。

1) 我已经能够克隆 ffmpeg。对于初学者来说,这将帮助您通过创建包含 ffmpeg 源的目录来开始。 (向编写它的人致敬)

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

2)我已经能够编写一个没有任何错误的配置文件。我们稍后再回到这部分。这是我附加到 ./configure 的命令

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2

--as='gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2'

--sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk

--cpu=cortex-a8 --extra-ldflags='-arch=armv7 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' --enable-pic --disable-bzlib --disable-gpl --disable-shared --enable-static --disable-mmx --disable-debug --disable-neon --extra-cflags='-pipe -Os -gdwarf-2 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -m${thumb_opt:-no-thumb} -mthumb-interwork'

这些是一些需要注意的事情。

  • 我必须下载(https://github.com/yuvi/gas-preprocessor)将文件gas-preprocessor.pl复制到/usr/local/bin。设置读写权限(777)
  • 确保我使用正确的 GCC 编译器:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm -gcc-4.2
  • 确保我使用正确的 SDK:/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
  • --extra-cflags="-arch armv7"原因:错误:无法识别的命令行选项“-arch”

问题就在这里。

我可以像这样包含库

libavcodec/avcodec.h

但是当我开始编写编码器时。我收到了这个警告,以及无数的错误。

ignoring file /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a, file was built for archive which is not the architecture being linked (armv7s): /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a

这意味着我没有构建正确的二进制文件。

我正在寻找以前做过这件事的人,引导我们所有人完成为 iOS6.0 和 ARMv7 构建 FFMPEG 的过程以及需要注意的大部分事情。非常感谢。

最佳答案

这是我在 iOS 6 上交叉编译 FFmpeg 的工作配置,架构是 ARMv7

注意:您必须拥有 gas-preprocessor.pl/usr/local/bin/ 内,请不要继续,直到您有 gas-preprocessor.pl在你的 bin 目录中

  • here下载FFmpeg 1.0“天使”

  • 解压缩并将其放置在某个位置,即您的桌面文件夹

  • 打开终端并浏览到解压的 FFmpeg 文件夹

  • 复制并粘贴以下命令,(耐心等待)

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/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/iPhoneOS6.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' --enable-pic --enable-decoder=rawvideo --disable-asm

  • 现在在终端 make 上输入以下命令(再等一下)

  • 完成后,在终端上输入 sudo make install(再次等待)

  • 前往 /usr/local/lib 找到刚出炉的 armv7

  • 享受吧!

亚历克斯

<小时/>

添加了对armv7s的支持

这个armv7s配置完全未经测试,我真的不知道这是否可行,我没有iPhone 5,所以我们需要有人来测试最终的armv7s库

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/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/iPhoneOS6.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7s' --extra-ldflags='-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' --enable-pic --enable-decoder=rawvideo --disable-asm

关于iphone - 为 iOS6.0 ARMv7 处理器构建 FFMPEG 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13061086/

相关文章:

iphone - 更改 .xcdatamodeld 文件中 .xcdatamodel 条目的顺序

iphone - 呈现一个没有 NIB 的自定义 UIViewController ? iPad

linux - 在 Alpine 上从源代码安装 GCC

java - 在 Java 中生成照片幻灯片并导出为视频

bash - 使用 FFmpeg 有条件地旋转风景的纵向视频

iphone - iOS 7 中的 UITabBar 色调

iphone - 如何以编程方式检查 Mobclix 广告是否正在运行?

gcc - TensorFlow 不使用 Debug模式构建

c - 指针在 printf 后改变值

video - 同时添加 2 秒延迟和延迟 -ffmpeg- 中的输入之一