简体   繁体   English

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

[英]Building FFMPEG library for iOS6.0 ARMv7 Processor

WARNING: 警告:

I was just informed by another user that there are some legal issues revolving around using FFMPEG for iOS, leaving the link here http://multinc.com/2009/08/24/compatibility-between-the-iphone-app-store-and-the-lgpl/ 我刚刚被其他用户告知,有一些法律问题围绕着使用FFMPEG for iOS,请点击这里链接http://multinc.com/2009/08/24/compatibility-between-the-iphone-app-store-和最LGPL /

I cleaned up my question a little bit, when I wrote it the first time I was flustered. 当我第一次感到慌乱的时候,我写了一下这个问题。 Now I can be more clear after taking a small break. 现在我可以在休息一下后更清楚。

Edit: learned that you have to build for ARMv7, ARMv7s and iOS6.0 编辑:了解到你必须为ARMv7,ARMv7s和iOS6.0构建

I'm trying to use the FFMPEG library in an XCode 4.5.1 project. 我正在尝试在XCode 4.5.1项目中使用FFMPEG库。 And I'm trying to build it for ARMv7. 我正在尝试为ARMv7构建它。 What I'm looking for is the exact process, and some explanation. 我正在寻找的是确切的过程和一些解释。 I understand that this is not a well documented problem. 我知道这不是一个记录良好的问题。 But I know that other pople have had the same problem as me. 但我知道其他人和我有同样的问题。

What I have been able to do. 我能做什么。

I have been able to build the library for testing. 我已经能够构建用于测试的库。

1) I have been able to clone ffmpeg. 1)我已经能够克隆ffmpeg。 For beginners this will get you started by creating a directory with the ffmpeg source. 对于初学者,这将通过使用ffmpeg源创建目录来开始。 (Kudos to the guys who wrote it) (感谢写这篇文章的人)

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

2) I have been able to write a config file that doesn't have any errors. 2)我已经能够编写一个没有任何错误的配置文件。 We will go back to this part later. 我们稍后会回到这一部分。 This is the command I attach to ./configure 这是我附加到./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 ./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch = arm --target-os = darwin --cc = / Applications / Xcode 。应用程序/内容/开发/平台/ iPhoneOS.platform /开发人员的/ usr / LLVM-GCC-4.2 /斌/ ARM-苹果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' --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 --sysroot = /应用/ xcode.app /内容/开发商/平台/ iPhoneOS.platform /开发商/软件开发工具包/ 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' --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'

These are some things to note. 这些是需要注意的事项。

  • I had to download ( https://github.com/yuvi/gas-preprocessor ) copy the file gas-preprocessor.pl at /usr/local/bin. 我必须下载( https://github.com/yuvi/gas-preprocessor )将文件gas-preprocessor.pl复制到/ usr / local / bin。 Set permissions to read write (777) 设置读写权限(777)
  • Make sure I'm using the right GCC compiler: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2 确保我使用正确的GCC编译器:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc- 4.2
  • Make sure I'm using the right SDK: /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk 确保我使用正确的SDK:/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
  • --extra-cflags="-arch armv7" causes: error: unrecognized command line option “-arch” --extra-cflags =“ - arch armv7”导致:错误:无法识别的命令行选项“-arch”

Here in lies the problem. 这就是问题所在。

I can include the library like so 我可以像这样包含库

libavcodec/avcodec.h 使用libavcodec /中avcodec.h

But when I started to write the encoder. 但是当我开始编写编码器时。 I received this warning, and countless errors. 我收到了这个警告,还有无数的错误。

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 忽略文件/Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a,文件是为存档而构建的,而不是被链接的架构(armv7s):/ Users / Jimmy / Development / sources.ffmpeg / Library / libavutil。一种

That means that I didn't build the right binary. 这意味着我没有构建正确的二进制文件。

What I'm looking for is someone whose done it before, to walk all of us through the process of building FFMPEG for iOS6.0 and ARMv7 and the majority of things to look out for. 我正在寻找的是之前完成它的人,让我们所有人都在构建针对iOS6.0和ARMv7的FFMPEG以及大多数需要注意的事项。 Thanks a ton. 万分感谢。

Here is my working Configure for cross-compiling FFmpeg on iOS 6 the arch is ARMv7 这是我的工作配置在iOS 6上交叉编译FFmpeg ,拱门是ARMv7

NOTE: You must have to have gas-preprocessor.pl inside /usr/local/bin/ please do not continue until you have gas-preprocessor.pl on your bin directory 注意:您必须要有gas-preprocessor.pl里面/usr/local/bin/请不要继续,直到你有gas-preprocessor.pl你的bin目录

  • Download FFmpeg 1.0 "Angel" from here 这里下载FFmpeg 1.0“天使”

  • Unzip it and place it somewhere ie your Desktop folder 解压缩并将其放在某处,即Desktop文件夹

  • Open terminal and browse to unzipped FFmpeg folder 打开终端并浏览到解unzipped FFmpeg folder

  • Copy and paste the following command, ( be patient will take a while ) 复制并粘贴以下命令,( 耐心等待一段时间

./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 ./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

  • Now type the following command on terminal make ( wait a little more ) 现在在终端make上键入以下命令( 稍等一会儿

  • Once it has finished now type on terminal sudo make install ( wait again ) 一旦完成,现在键入终端sudo make install再次等待

  • Go to /usr/local/lib to find your freshly baked armv7 libs 转到/usr/local/lib找到新近出炉的armv7

  • Enjoy! 请享用!

Alex 亚历克斯


Added Support for armv7s 添加了对armv7的支持

This armv7s configure is totally untested and i dont really know if this would work, i don't own an iPhone 5 so we need someone to test the final armv7s libs 这个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 ./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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM