【问题标题】:Installing ffmpeg ios libraries armv7, armv7s, i386 and universal on Mac with 10.8在 10.8 的 Mac 上安装 ffmpeg ios 库 armv7、armv7s、i386 和通用
【发布时间】:2013-08-02 21:44:41
【问题描述】:

如何在 10.8 的 Mac 上安装最新的 ffmpeg ios 库 armv7、armv7s、i386 和通用?

【问题讨论】:

标签: ios ffmpeg


【解决方案1】:

几天后,我为这个安装制定了分步说明:

FFmpeg 构建说明 MAC 10.8 或更高版本

复制 ffmpeg-2.0.tar.bz2 (https://ffmpeg.org/releases/ffmpeg-1.0.7.tar.bz2, https://ffmpeg.org/download.html) 并解压到 Documents 文件夹

确保你在 Xcode 下拥有最新的命令行工具 >;偏好 >;下载 >;组件

安装气体预处理器

  1. 点击 ZIP 图标下载https://github.com/mansr/gas-preprocessor
  2. 将 gas-preprocessor.pl 复制到 /usr/bin 目录。
  3. 通过将权限设置为 Read & Write for all 来更改 gas-preprocessor.pl 的权限。

从版本 10.8 开始的 xcrun 中的错误

打开终端并粘贴以下命令并回车:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"

cd 到 ffmpeg-2 文件夹并粘贴以下命令并回车:

mkdir armv7
mkdir armv7s
mkdir i386
mkdir -p universal/lib

要配置 armv7s 库,请粘贴以下命令并回车:

./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=6.1" --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1" --arch=arm --cpu=cortex-a9 --enable-pic

(注意与上面相同的规则:如果配置失败转到 应用程序/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ 并确保 sdk 文件夹是 iPhoneOS6.1.sdk,如果不更改 配置命令以反映 iPhoneOSx.x.sdk 并更改所有目标 到 x.x)

要构建和安装 armv7s 库,请粘贴以下命令并回车:

make clean && make && make install

要配置 i386(因此模拟器将工作)库粘贴在以下命令中并按 Enter:

./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 库,请粘贴以下命令并按 Enter:

make clean && make && make install

要制作通用库(即添加到 xcode 中的库),粘贴以下命令并按 Enter:

cd armv7/lib
for file in *.a
do
cd ../..
xcrun -sdk iphoneos lipo -output universal/lib/$file  -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$file
echo "Universal $file created."
cd -
done
cd ../..

【讨论】:

  • Formatting the code 将使这更容易阅读。您可以突出显示文本并按 ctrl+k 或 command+k(我认为),或者单击文本框上方的代码按钮,看起来像 {}
  • 可以添加对iOS7的支持吗?
  • 我尝试将上述指令与来自ffmpeg.org/releases 的ffmpeg2.2 和来自这里github.com/michaelni/gas-preprocessor 的gas-preprocessor 一起使用,但是,我只有静态库文件(我可以从中创建可执行文件吗?) ,我在任何地方都看不到ffmpeg ...?我应该从配置中删除 disable-ffmpeg 吗?你能详细说明每个参数的含义吗?如果我只想从一种音频文件格式转换为另一种? (或将立体声合并到单声道?)我应该使用什么设置来配置上面的脚本?我希望二进制输出尽可能小...
【解决方案2】:

支持 iOS7 和 XCode5 的通用 ffmpeg 库:

确保你在 Xcode 下拥有最新的命令行工具 >;偏好 >;下载 >;组件

安装气体预处理器

  1. 点击 ZIP 图标下载https://github.com/mansr/gas-preprocessor
  2. 将 gas-preprocessor.pl 复制到 /usr/bin 目录。
  3. 通过将权限设置为所有人的读写权限来更改 gas-preprocessor.pl 的权限。

https://gist.github.com/m1entus/6983547下载我的shell脚本

  1. 运行sh build-ffmpeg.sh

【讨论】:

  • 太棒了,我为此浪费了很多时间。 :D
  • 还要检查运行此脚本的目录的路径不包含空格
  • 我收到此错误/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file. C compiler test failed. GCC 在 Xcode5 中显然已贬值。我很不确定下一步该做什么。
  • 确保你在 Xcode 下拥有最新的命令行工具 >;偏好 >;下载 >;组件
  • 我也遇到了 Joseph Toronto 问题,而且我似乎正在使用最新的 5.1.1 命令行工具。我可以选择 4.x 和 5.x
【解决方案3】:

我需要 arm64 支持,这个脚本对我有用:https://github.com/kewlbear/FFmpeg-iOS-build-script

使用

./build-ffmpeg.sh arm64 x86_64

适用于 iOS 64 位和模拟器架构。然后将“fat”目录下的内容复制到你的Xcode项目中。

我对脚本所做的唯一修改是取消注释这一行:

CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-avresample"

编译 libavresample 库。

编辑:但是,它不适用于 armv7 和 armv7s,使用 iOS 7.1 SDK。如果我找到解决方案,我会在这里发布。

【讨论】:

  • 不应该只在命令行脚本中添加 armv7 和 armv7s 吗?
【解决方案4】:

要构建 ffmpeg iOS 库,您可以使用 this little scripts

  1. 下载ffmpeg源码
  2. 下载https://github.com/wang-bin/build_ffmpeg
  3. 打开终端并运行export FFSRC=/path/to/ffmpeg
  4. 转到build_ffmpeg 文件夹并运行:./ios.sh
  5. 构建成功后,结果会在sdk-ios文件夹中
  6. 在您的 Xcode 项目中添加包含文件夹和 lib 文件夹

【讨论】:

    猜你喜欢
    • 2015-03-10
    • 2014-05-12
    • 2015-10-12
    • 2012-01-09
    • 1970-01-01
    • 1970-01-01
    • 2013-07-19
    • 1970-01-01
    • 2017-08-07
    相关资源
    最近更新 更多