如何在 10.8 的 Mac 上安装最新的 ffmpeg ios 库 armv7、armv7s、i386 和 Universal?
4 回答
几天后,我对此安装进行了分步说明:
FFmpeg 构建说明 MAC 10.8 或更高版本
复制 ffmpeg-2.0.tar.bz2 ( https://ffmpeg.org/releases/ffmpeg-1.0.7.ta r.bz2 , https://ffmpeg.org/download.html ) 并解压到 Documents 文件夹
确保您在 Xcode > 下拥有最新的命令行工具;偏好 >; 下载 >; 成分
安装气体预处理器
- 点击 ZIP 图标下载https://github.com/mansr/gas-preprocessor。
- 将 gas-preprocessor.pl 复制到 /usr/bin 目录。
- 通过将权限设置为 Read & Write for all 来更改 gas-preprocessor.pl 的权限。
从版本 10.8 开始的 xcrun 中的错误
打开终端并粘贴以下命令并按Enter:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"
cd 到 ffmpeg-2 文件夹并粘贴以下命令并按 Enter:
mkdir armv7
mkdir armv7s
mkdir i386
mkdir -p universal/lib
要配置 armv7s 库,请粘贴以下命令并按 Enter:
./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
(注意与上面相同的规则:如果配置失败,请转到 Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ 并确保 sdk 文件夹是 iPhoneOS6.1.sdk,如果不更改配置命令以反映 iPhoneOSx.x.sdk 并将所有目标更改为 xx)
要构建和安装 armv7s 库,请粘贴以下命令并按 Enter:
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 ../..
支持 iOS7 和 XCode5 的通用 ffmpeg 库:
确保您在 Xcode > 下拥有最新的命令行工具;偏好 >; 下载 >; 成分
安装气体预处理器
- 点击 ZIP 图标下载https://github.com/mansr/gas-preprocessor。
- 将 gas-preprocessor.pl 复制到 /usr/bin 目录。
- 通过将权限设置为 Read & Write for all 来更改 gas-preprocessor.pl 的权限。
从以下位置下载我的 shell 脚本:https ://gist.github.com/m1entus/6983547
- 运行
sh build-ffmpeg.sh
。
我需要 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。如果我找到解决方案,我会在这里发布。
要构建 ffmpeg iOS 库,您可以使用这个小脚本。
- 下载ffmpeg源码
- 下载https://github.com/wang-bin/build_ffmpeg
- 打开终端并运行
export FFSRC=/path/to/ffmpeg
- 转到
build_ffmpeg
文件夹并运行:./ios.sh
- 成功构建后,结果将在
sdk-ios
文件夹中 - 在您的 Xcode 项目中添加包含文件夹和 lib 文件夹