iOS編譯ffmpeg

來源:互聯網
上載者:User

編譯模擬器版本
1 到https://github.com/yuvi/gas-preprocessor下載gas-preprocessor.p並拷貝到/usr/sbin目錄中
2 下載ffmpeg源碼。
http://ffmpeg.org/download.html
https://github.com/FFmpeg/FFmpeg
3 解壓源碼,cd到源碼目錄下
4 建立檔案config_i386.sh,其內容如下

#!/bin/tcsh -fset targetDir="../ffmpeg-libs/i386"if (! -d $targetDir ) mkdir $targetDirrm -f $targetDir/*.amake clean#./configure --arch=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386'  --disable-encoders --disable-debug --disable-mmx./configure \--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \--nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm" \--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk \--target-os=darwin \--arch=i386 \--cpu=i386 \--extra-cflags='-arch i386 -miphoneos-version-min=4.3 -mdynamic-no-pic' \--extra-ldflags='-arch i386 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' \--prefix=compiled/i386 \--enable-cross-compile \--enable-nonfree \--enable-gpl \--disable-armv5te \--disable-swscale-alpha \--disable-doc \--disable-ffmpeg \--disable-ffplay \--disable-ffprobe \--disable-ffserver \--disable-asm \--disable-debugmakemv libavcodec/libavcodec.a $targetDirmv libavdevice/libavdevice.a $targetDirmv libavformat/libavformat.a $targetDirmv libavutil/libavutil.a $targetDirmv libswscale/libswscale.a $targetDir

5 執行config_i386.sh進行配置和編譯
編譯完成後,可以在$targetDir找到相應的靜態庫檔案

編譯真機版
前3步同上
第4步:建立檔案config_armv7,其內容如下

#!/bin/tcsh -fset targetDir="../ffmpeg-libs/armv7"if (! -d $targetDir ) mkdir $targetDirrm -f $targetDir/*.amake clean./configure \--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \--nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/nm" \--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk \--target-os=darwin \--arch=arm \--cpu=cortex-a8 \--extra-cflags='-arch armv7 -miphoneos-version-min=4.3 -mdynamic-no-pic' \--extra-ldflags='-arch armv7 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' \--prefix=compiled/armv7 \--enable-cross-compile \--enable-nonfree \--enable-gpl \--disable-armv5te \--disable-swscale-alpha \--disable-doc \--disable-ffmpeg \--disable-ffplay \--disable-ffprobe \--disable-ffserver \--disable-asm \--disable-debugmakemv libavcodec/libavcodec.a $targetDirmv libavformat/libavformat.a $targetDirmv libavutil/libavutil.a $targetDirmv libswscale/libswscale.a $targetDir

第5步:
執行config_armv7進行配置和編譯,編譯完成後可以在$targetDir找到相應的靜態庫檔案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.