compiling ffmpeg for iFrameExtractor

转自:http://stackoverflow.com/questions/6994151/problem-compiling-ffmpeg-for-iframeextractor


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.

你可能感兴趣的:(ios,xcode,git,iPhone,Build,Terminal)