我该如何在Mac OS 10.8上安装最新的ffmpeg ios库,包括armv7、armv7s、i386和通用版本?
几天后,我为此安装制作了逐步说明:
在MAC 10.8或更高版本中构建FFmpeg的说明:
复制ffmpeg-2.0.tar.bz2 (https://ffmpeg.org/releases/ffmpeg-1.0.7.tar.bz2, https://ffmpeg.org/download.html)并将其解压到文档文件夹
确保您拥有最新版本的Xcode命令行工具 >; 首选项 >; 下载 >; 组件
安装gas-preprocessor
版本10.8中xcrun中存在错误
打开终端并粘贴以下命令,然后按Enter键:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"
进入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,并将所有目标更改为x.x)
要构建和安装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库,请粘贴以下命令并按回车键:
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 ../..
{}
的代码按钮。 - llogan支持iOS7和XCode5的通用ffmpeg库:
确保您拥有最新的Command Line Tools,路径为Xcode >; Preferences >; Downloads >; Components
安装gas-preprocessor
从https://gist.github.com/m1entus/6983547下载我的shell脚本。
sh build-ffmpeg.sh
。/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 无法创建可执行文件。C 编译器测试失败。
在 Xcode5 中 GCC 已被弃用,我不太确定接下来该怎么做。 - Joseph Toronto./build-ffmpeg.sh arm64 x86_64
针对iOS的64位和模拟器架构。然后将“fat”目录中的内容复制到您的Xcode项目中。
我所做的唯一修改是取消注释此行:
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-avresample"
编译libavresample库。
编辑:使用iOS 7.1 SDK时,它不能与armv7和armv7s一起工作。如果我找到解决方案,我会在这里发布。
要构建ffmpeg iOS库,您可以使用这个小脚本。
export FFSRC=/path/to/ffmpeg
build_ffmpeg
文件夹并运行:./ios.sh
sdk-ios
文件夹中