IOS平台上使用FFmpeg解码H264的例子
https://github.com/lajos/iFrameExtractor
Xcode4.5 安装路径变了的缘故吧,修改了下build_armv6 build_armv7 build_i386 三个编译脚本
build_armv6
- #!/bin/tcsh -f
-
- if (! -d armv6) mkdir armv6
- if (! -d lib) mkdir lib
-
- rm armv6/*.a
-
- make clean
-
- ./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=arm1176jzf-s --extra-cflags='-arch armv6'
- --extra-ldflags='-arch armv6 -isysroot
- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk'
-
- make -j4
-
- 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-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
-
- make -j4
-
- 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-mmx --disable-doc --disable-ffmpeg
- --disable-ffplay --disable-ffserver
- --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/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk
- --extra-ldflags="-arch i386
- -L/Applications/Xcode.app/Contents/Developer/Platforms
- /iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.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
- /Applications/Xcode.app/Contents/Developer/Platforms
- /iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk
- -fvisibility=hidden -mmacosx-version-min=10.5 -gdwarf-2"
-
- make -j4
-
- 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/
没有真机,模拟器就使用i386编译出来的库。
用xcode打开项目,编译运行。
接下来 学习Objective-C,移植rtmpdump,能直接使用FFmpeg里的rtmp协议处理最好
(bashell) |