IOS 編譯ffmpeg For SDK6.1,模擬器、armv7、armv7s均可使用

來源:互聯網
上載者:User

最近在研究IOS視頻播放器,需要使用到ffmpeg4ios,所以整理編譯過程。

需要使用到Git,Linux Shell指令碼執行install-ffmpeg.sh即可。

下述Linux Shell指令碼:http://ishare.iask.sina.com.cn/f/37135883.html

install-ffmpeg.sh

SRCDIR==/install- - [ ! -e ffmpeg--O  http:-/compile-*.sh  [ -/ffmpeg-${VERSION}//compile-/compile-/compile-/compile-universal.sh

 

install-gas.sh

echo -f gas-preprocessor/gas-preprocessor.pl /usr/sbin/+x /usr/sbin/gas-

 

compile-armv7s.sh

SRCDIR==/=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin//--host=arm-apple---sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/--prefix=build/--extra-cflags=--extra-ldflags=--enable-pic --disable-shared --enable-&&/--prefix=--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/--=--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/--extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk/usr/lib/--target-os=--arch=--cpu=cortex---extra-cflags=--extra-ldflags=--enable---enable-cross---enable---enable---disable---disable---disable---disable--p ./build/-f ./libavcodec/libavcodec.a ./build/armv7s/-f ./libavdevice/libavdevice.a ./build/armv7s/-f ./libavfilter/libavfilter.a ./build/armv7s/-f ./libavformat/libavformat.a ./build/armv7s/-f ./libavutil/libavutil.a ./build/armv7s/-f ./libswscale/libswscale.a ./build/armv7s/libswscale.a

 

compile-armv7.sh

SRCDIR==/=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin//--host=arm-apple---sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/--prefix=build/--extra-cflags=--extra-ldflags=--enable-pic --disable-shared --enable-&&/--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/--=--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/--extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk/usr/lib/--target-os=--arch=--cpu=cortex---extra-cflags=--extra-ldflags=--enable---enable-cross---enable---enable---disable---disable---disable---disable--p ./build/-f ./libavcodec/libavcodec.a ./build/armv7/-f ./libavdevice/libavdevice.a ./build/armv7/-f ./libavfilter/libavfilter.a ./build/armv7/-f ./libavformat/libavformat.a ./build/armv7/-f ./libavutil/libavutil.a ./build/armv7/-f ./libswscale/libswscale.a ./build/armv7/libswscale.a

 

compile-i386.sh

SRCDIR==/=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin//--host=i386-apple---sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/--prefix=build/--extra-cflags=--extra-ldflags=--enable-pic --disable-shared --enable- --disable-&&/--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/--=--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/--extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVERSION}.sdk/usr/lib/--target-os=--arch=--cpu=--extra-cflags=--extra-ldflags=--enable---enable-cross---enable---enable---disable---disable---disable---disable---disable--p ./build/-f ./libavcodec/libavcodec.a ./build/i386/-f ./libavdevice/libavdevice.a ./build/i386/-f ./libavfilter/libavfilter.a ./build/i386/-f ./libavformat/libavformat.a ./build/i386/-f ./libavutil/libavutil.a ./build/i386/-f ./libswscale/libswscale.a ./build/i386/libswscale.a

 

compile-universal.sh

-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./build/--arch armv7s ./build/armv7s/-arch armv7 ./build/armv7/-arch i386 ./build/i386/-sdk iphoneos lipo -output ./x264/build/--arch armv7s ./x264/build/armv7s/lib/-arch armv7 ./x264/build/armv7/lib/-arch i386 ./x264/build/i386/lib/libx264.a

 

編譯出來的檔案為:

libavcodec.a

用於各種類型聲音/映像編解碼;

libavdevice.a

libavfilter.a

libavformat.a  

用於各種音視頻封裝格式的產生和解析,包括擷取解碼所需資訊以產生解碼上下文結構和讀取音視訊框架等功能;

libavutil.a

包含一些公用的工具函數;

libswscale.a

用於視頻情境比例縮放、色彩映射轉換;

libx264.a

 

開源樣本iFrameExtractor

git clone git://github.com/lajos/iFrameExtractor.git

這是一個iOS下利用ffmpeg解碼播放的例子。不過這個例子是利用貼圖的方式來顯示,效果不是很好,而且沒有加入聲音解碼。

 

要想項目順利運行需要添加支援庫

Project References -> Targets -> Build Phases -> Link Binary With Librarys

  • libbz.dylib
  • libz.dylib
  • libiconv.2.4.0.dylib

 

修改標頭檔搜尋路徑(標頭檔:http://www.ffmpeg4ios.org/releases/ffmpeg4ios-1.0-include.zip)

Project References -> Targets -> Build Settings -> Header Search Paths

 

修改庫檔案搜尋路徑(編譯出來.a檔案的路徑)

Project References -> Targets -> Build Settings -> Library Search Paths  

 

有疑問者可以留言

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.