在iOS上使用ffmpeg播放視頻


國外靠譜的有這幾個:
1、Mooncatventures group https://github.com/mooncatventures-group

2、KxMoviePlayer (use OpenGLES, Core Audio) https://github.com/kolyvan/kxmovie

3、FFmpeg for ios (with OpenGLES, AudioQueue) https://github.com/flyhawk007/FFmpeg-for-iOS.git

4、iFrameExtractor https://github.com/lajos/iFrameExtractor.git

當然還有ffmpeg自帶的ffplay,如果想學習ffplay可以參考ffmpeg tutorial http://dranger.com/ffmpeg/  中文版連接:http://download.csdn.net/detail/dayudian/4600783(這個好多地方都有,可以自己搜索)

SDL:現在SDL1.3已有iOS版本,可以直接編譯.a文件。
下載地址:SDL 1.3 is ready for a massive bug hunt!
http://www.libsdl.org/tmp/SDL-1.3.zip
or
http://www.libsdl.org/tmp/SDL-1.3.tar.gz

音頻:使用audiocore播放音頻只能播放iOS支持的音頻格式,使用SDL播放音頻沒有限制。

 

移值FFMPEG到iPhone或Mac OS/X

 

有關FFMPEG的詳細說明可以參考網上相關文檔;在這里我們只講述FFMPEG移到iPhone或Mac OS/X的過程及相關注意事項。

 

FFMPEG功能相當強大,在完整的FFMPEG包中就包含了ffserver, ffplay, ffmpeg, avcodec, avdevice, avformat, avutil, swscale等;其中ffserver, ffplay, ffmpeg為應該程序,對與我們這些從事軟件開發的人來說基本上沒什么用;而avcodec為加解碼庫、avformat為格式庫,avutil則為基礎庫(但平常我們很少用到), swscale則為圖象處理庫;所以我們所要的就是移值avcodec, avformat, avutil, swscale這四個庫。

 

移值到Mac OS/X下過程:

 

一、   配置

 

./configure --prefix=/Developer/usr --cc=/Developer/usr/bin/gcc-4.0 --enable-gpl --enable-shared --disable-ipv6 --enable-swscale --enable-zlib --enable-bzlib --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-vhook

 

二、   編譯

 

make

 

三、   安裝

 

make install

 

說明:上面的/Developer/usr為目標目錄,如果你的Xcode為默認安裝,則這樣安裝后既可以在Xcode中編譯及調式你的代碼了;

 

移值到Mac OS/X下的模擬iPhone平台下過程:

 

一、   配置

 

./configure --prefix=/Developer/usr --disable-debug --cc=/Developer/usr/bin/i686-apple-darwin9-gcc-4.0.1 --enable-gpl --enable-static --disable-shared --disable-ipv6 --enable-swscale --enable-zlib --enable-bzlib --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-vhook --enable-pthreads

 

二、   編譯

 

make

 

三、   安裝

 

make install

 

說明:上面的/Developer/usr為目標目錄,如果你的Xcode為默認安裝,則這樣安裝后既可以在Xcode中編譯及在模擬器下調式你的代碼了;

 

移值到iPhone平台下過程:

 

一、   配置

 

./configure --enable-cross-compile --cross-prefix=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1 --prefix=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr --extra-cflags="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk" --extra-ldflags="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -Wl,-syslibroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk" --arch=armv6 --enable-armv6 --enable-gpl --enable-shared --disable-ipv6 --enable-swscale --enable-zlib --enable-bzlib --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-vhook

 

二、   編譯

 

make

 

三、   安裝

 

make install

 

說明:上面的/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/為目標目錄,如果你的Xcode為默認安裝,則這樣安裝后既可以在Xcode中編譯及在模擬器下調式你的代碼了。

 

相關說明:

 

    在ffmpeg中如果使用靜態庫則會出現一些連接錯;所以在安裝ffmpeg庫時請選中動態庫。

 

OK,到現在我們就你已經知道了如何把ffmpeg移到到iPhone下並把ffmpeg庫和Xcode結合起來了吧;當然如果你的Xcode工具非默認安裝,請更上相關目錄選項.

 

http://www.cocoachina.com/bbs/simple/?t75338.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM