admin管理员组文章数量:1550527
鄙视并感谢一下这个假冒原创:http://blog.csdn/artwebs/article/details/9048067
本文参考资料2: http://www.94it/a/jingxuanboke/2013/0503/6095.html
=====================================
先说一下我的编译环境:MacOS10.8.3、Xcode4.6(4H127)、IOS6.1
文档提供了编译FFmpeg i386(模拟器)版本、armv7版本(iPhone 3GS以上)、armv7s(iPhone5)版本等lib库的方法,最后还提供了一种把这三个版本合为一种公共lib库的脚本,模拟器和真机只需要一套库文件即可。
1.提前准备Command Line Tools,在Xcode-Preference-Downloads-Components下载。
2.从官网下载最新版本的 ffmpeg-0.8.14,解压到桌面或者下载里面,方便编译。从下图可以看到有很多链接可以下载
3.下载最新版本的gas-preprocessor,解压,拷贝gas-preprocessor.pl到 /usr/bin 目录中。注意这个目录是个系统目录,默认隐藏了,直接查看不到。可以先点击一下Finder,上面菜单 前往-前往文件夹,或者直接选中了Finder后按command+shift+g快捷键,粘贴/usr/bin后“前往”就可以打开这个目录了。
4.打开终端,使用cd命令切换到第二步解压后的ffmpeg目录,比如我的是 cd Desktop/ffmpeg-0.8.14/,然后在这个文件夹建立几个目录,方便编译时生成lib库,也方便查找,或者使用以下命令在终端里面执行生成,一行一行来。执行完成后,可以在ffmpeg-1.2/文件夹里面看到armv7、armv7s、i386、universal/lib等文件夹。
- mkdir armv7
- mkdir armv7s
- mkdir i386
- mkdir -p universal/lib
5.编译ffmpeg armv7(iPhone 3GS以上)版本,复制以下命令到终端里面执行。注意如果你的SDK是IOS6.0,只需要把iPhoneOS6.1换成iPhoneOS6.0即可
./configure --prefix=armv7 --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='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.1.sdk --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system --target-os=darwin --arch=arm --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic --enable-cross-compile --enable-ffmpeg --disable-ffplay --disable-ffserver --disable-asm --disable-encoders --disable-decoders --enable-decoder=h264 --disable-doc
复制以下命令在终端里面回车执行:
make clean && make && make install
6.编译ffmpeg armv7s(iPhone5)版本,复制以下命令到终端里面回车执行:
./configure --prefix=armv7s --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.0" --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.0" --arch=arm --cpu=cortex-a9 --enable-pic --enable-cross-compile --enable-ffmpeg --disable-ffplay --disable-ffserver --disable-asm --disable-encoders --disable-decoders --enable-decoder=h264 --disable-doc
复制以下命令在终端里面回车执行:
make clean && make && make install7.编译ffmpeg i386(模拟器)版本,复制以下命令到终端里面回车执行:
./configure --prefix=i386 --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 --enable-cross-compile --enable-ffmpeg --disable-ffplay --disable-ffserver --disable-asm --disable-encoders --disable-decoders --enable-decoder=h264
复制以下命令在终端里面回车执行:
make clean && make && make install
lipo -create -arch armv7k armv7s/lib/libavcodec.a -arch armv7 armv7/lib/libavcodec.a -arch i386 i386/lib/libavcodec.a -output universal/libavcodec.a
lipo -create -arch armv7k armv7s/lib/libavdevice.a -arch armv7 armv7/lib/libavdevice.a -arch i386 i386/lib/libavdevice.a -output universal/libavdevice.a
lipo -create -arch armv7k armv7s/lib/libavformat.a -arch armv7 armv7/lib/libavformat.a -arch i386 i386/lib/libavformat.a -output universal/libavformat.a
lipo -create -arch armv7k armv7s/lib/libavutil.a -arch armv7 armv7/lib/libavutil.a -arch i386 i386/lib/libavutil.a -output universal/libavutil.a
lipo -create -arch armv7k armv7s/lib/libswscale.a -arch armv7 armv7/lib/libswscale.a -arch i386 i386/lib/libswscale.a -output universal/libswscale.a
lipo -create -arch armv7k armv7s/lib/libavfilter.a -arch armv7 armv7/lib/libavfilter.a -arch i386 i386/lib/libavfilter.a -output universal/libavfilter.a
=======下面是一样的,好像,复制,备用,作比较========
先说一下我的编译环境:MacOS10.8.3、Xcode4.6(4H127)、IOS6.1 文档提供了编译FFmpeg i386(模拟器)版本、armv7版本(iPhone 3GS以上)、armv7s(iPhone5)版本等lib库的方法,最后还提供了一种把这三个版本合为一种公共lib库的脚本,模拟器和真机只需要一套库文件即可。
1.提前准备Command Line Tools,在Xcode-Preference-Downloads-Components下载。
2.从官网下载最新版本的 ffmpeg-1.2,解压到桌面或者下载里面,方便编译。从下图可以看到有很多链接可以下载
但是我试了下,git上面的都不是最新版本,滚动屏幕的下方可以看到有个地方可以直接下载,看日期是最新版1.2版本 Download bzip2 tarball
3.下载最新版本的gas-preprocessor,解压,拷贝gas-preprocessor.pl到 /usr/bin 目录中。注意这个目录是个系统目录,默认隐藏了,直接查看不到。可以先点击一下Finder,上面菜单 前往-前往文件夹,或者直接选中了Finder后按command+shift+g快捷键,粘贴/usr/bin后“前往”就可以打开这个目录了。
4.打开终端,使用cd命令切换到第二步解压后的ffmpeg目录,比如我的是 cd Desktop/ffmpeg-1.2/,然后在这个文件夹建立几个目录,方便编译时生成lib库,也方便查找,或者使用以下命令在终端里面执行生成,一行一行来。执行完成后,可以在ffmpeg-1.2/文件夹里面看到armv7、armv7s、i386、universal/lib等文件夹。
mkdir armv7 mkdir armv7s mkdir i386 mkdir -p universal/lib
5.编译ffmpeg armv7(iPhone 3GS以上)版本,复制以下命令到终端里面执行。注意如果你的SDK是IOS6.0,只需要把iPhoneOS6.1换成iPhoneOS6.0即可
./configure \ --prefix=armv7 \ --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 armv7 -mfpu=neon -miphoneos-version-min=6.0" \ --extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.0" \ --arch=arm \ --cpu=cortex-a9 \ --enable-pic \完成后在最后你可以看到这样一行文字:WARNING: Compiler does not indicate floating-point ABI, guessing soft.然后接着复制以下命令在终端里面回车执行:make clean && make && make install完成后你就可以在ffmpeg-1.2/armv7文件夹下面看到include、lib文件夹,lib目录下全是.a文件。
6.编译ffmpeg armv7s(iPhone5)版本,复制以下命令到终端里面回车执行:
./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.0" \ --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.0" \ --arch=arm \ --cpu=cortex-a9 \ --enable-pic \同样,完成后在最后你可以看到这样一行文字:
WARNING: Compiler does not indicate floating-point ABI, guessing soft.接着一样,复制以下命令在终端里面回车执行:
make clean && make && make install
./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 \
同样,完成后在最后你可以看到这样一行文字:
WARNING: Compiler does not indicate floating-point ABI, guessing soft.接着一样,复制以下命令在终端里面回车执行:
make clean && make && make install
版权声明:本文标题:MacOS10.8.3+Xcode4.6+IOS6.1 编译FFmpeg,简单使用 (未验证,作标记备用) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1727248439a1104926.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论