Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

iphone - problem compiling ffmpeg for iFrameExtractor

I'm trying to compile the ffmpeg by using the make and build files in iFrameExtractor example. firstly i tried to follow the readme file on the github, which only says to run the ./build_universal in ffmpeg folder. it did not work

i then tried to follow the info in INSTALL without success. i then tried doing the stuff in INSTALL followed by the ./build_universal which didn't work. All the *.a files that are imported to the project exists until the end of the build sequence. when the lipo commands in build_universal are run, which i guess concat the .a files for the different architectures(?). anyhow these leave the following errors:

lipo: specifed architecture type (armv6) for file (armv6/libavcodec.a) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (6))
lipo: specifed architecture type (armv6) for file (armv6/libavdevice.a) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (6))
lipo: specifed architecture type (armv6) for file (armv6/libavformat.a) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (6))
lipo: specifed architecture type (armv6) for file (armv6/libavutil.a) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (6))
lipo: specifed architecture type (armv6) for file (armv6/libswscale.a) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (6))

i can get the project to compile for simulator if i only use ./build_armv7 but if i run the universal the .a files are removed in the end. and only using doesn't work to build for iphone 4 .

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After a week of trial and error, I was finally able to create the ffmpeg universal libraries and successfully compile and run iFrameExtractor for the device as well as the simulator.

To compile and run the project on your iPhone device OR simulator:

1) open Terminal

2) clone the repository: git clone git://github.com/lajos/iFrameExtractor.git

3) go to the ffmpeg folder in the project: cd iFrameExtractor/ffmpeg

4) run: ./configure

5) Edit the build scripts (build_armv6, build_armv7, build_i386) as follows:

These scripts assume you are using iOS SDK 5.0 on Xcode 4.2.

build_armv6:

#!/bin/tcsh -f

if (! -d armv6) mkdir armv6
if (! -d lib) mkdir lib

rm armv6/*.a

make clean

./configure 
--disable-bzlib --disable-doc 
--disable-ffmpeg --disable-ffplay 
--disable-ffserver --disable-mmx 
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 
--as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 
--enable-cross-compile --target-os=darwin 
--arch=arm --cpu=arm1176jzf-s 
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk 
--extra-ldflags="-arch armv6 -L//Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system" 
--extra-cflags="-arch armv6"

make

mv libavcodec/libavcodec.a armv6/
mv libavdevice/libavdevice.a armv6/
mv libavformat/libavformat.a armv6/
mv libavutil/libavutil.a armv6/
mv libswscale/libswscale.a armv6/

rm lib/*.a

cp armv6/*.a lib/

build_armv7:

#!/bin/tcsh -f

if (! -d armv7) mkdir armv7
if (! -d lib) mkdir lib

rm armv7/*.a

make clean

./configure 
--disable-bzlib --disable-doc 
--disable-ffmpeg --disable-ffplay 
--disable-ffserver --disable-mmx 
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 
--as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 
--enable-cross-compile --target-os=darwin 
--arch=arm --cpu=cortex-a8 --enable-pic 
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk 
--extra-ldflags="-arch armv7 -    L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system" 
--extra-cflags="-arch armv7"

make

mv libavcodec/libavcodec.a armv7/
mv libavdevice/libavdevice.a armv7/
mv libavformat/libavformat.a armv7/
mv libavutil/libavutil.a armv7/
mv libswscale/libswscale.a armv7/

rm lib/*.a

cp armv7/*.a lib/

build_i386:

#!/bin/tcsh -f

if (! -d i386) mkdir i386
if (! -d lib) mkdir lib

rm i386/*.a

make clean

./configure 
--disable-bzlib --disable-doc 
--disable-ffmpeg --disable-ffplay 
--disable-ffserver --disable-mmx 
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 
--as='gas-preprocessor/gas-preprocessor.pl     /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 
--sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk 
--extra-ldflags="-arch i386 -L//Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/lib/system" 
--extra-cflags="-arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -O0 -fasm-blocks -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fvisibility=hidden -mmacosx-version-min=10.5 -gdwarf-2"

make

mv libavcodec/libavcodec.a i386/
mv libavdevice/libavdevice.a i386/
mv libavformat/libavformat.a i386/
mv libavutil/libavutil.a i386/
mv libswscale/libswscale.a i386/

rm lib/*.a

cp i386/*.a lib/

6) build the ffmpeg libraries: ./build_universal

7) open the xcode project and run it on your iPhone device or simulator

These steps work perfectly for me. I hope this will help others struggling to get the ffmpeg libraries working for iOS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...