mac ffplay

使用ffplay播放rtmp直播live視頻php

轉載請註明原文:http://blog.sina.com.cn/s/blog_5fde6089010198a9.html     做者:shuiyourenhtml

 

最簡單效率的方法是:git

一、下載並安裝homebrew;github

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"ruby

brew doctor (檢測是否安裝成功)curl

 

二、執行如下命令:ide

brew install openssl (經過查看Makefile可知,rtmpdump須要openssl支持)測試

brew rtmpdump (通過測試,必需要有librtmp,自帶的rtmp只能支持播放非直播的rtmp,而添加librtmp以後是能夠播放直播的視頻)字體

sudo chmod a+w /usr/local/Cellar/rtmpdump/2.3/include/librtmp/rtmp.h(須要修改權限,具體哪一個沒具體研究,都改了吧)ui

sudo chmod a+w /usr/local/include/librtmp

brew install rtmpdump(若發現未能link成功,則brew link rtmpdump ;若是之前安裝過則要進行刪除操做:sudo rm -f $(brew link --overwrite --dry-run rtmpdump | grep "^[^W]");)

 

三、進行ffmpeg的安裝(查看ffplay須要SDL-devel 的支持,參考出處忘了,由於文章是隔天寫的,抱歉。sudo rpm -i SDL-devel-1.2.15-1.x86_64.rpm.txt,地址:http://www.libsdl.org/release/SDL-devel-1.2.15-1.x86_64.rpm固然,前提是你mac安裝了rpm,rpm下載地址:http://rpm5.org/files/rpm/rpm-5.1/BINARY/RPM5-20080414.dmg,注:我當時好像使用的是SDL源碼安裝,故未用到rpm,sdl源碼地址:http://www.libsdl.org/release/SDL-1.2.15.tar.gz):

進入ffmpeg文件夾,進行以下操做:

./configure --disable-yasm --enable-librtmp --enable-decoder=h264

make

sudo make install

 

四、好了,能夠進行rtmp直播了:

ffplay -i "rtmp://192.168.1.13/room1/room1 live=1"

 

 

 

 

 

 

 

 

 

如下灰色字體文字實現方法還沒有實現(多是參數緣故),待研究:

咱們在使用ffmpeg支持rtmp時,常遇到如下幾個問題:

一、ERROR: librtmp not found

二、ld: library not found for -lrtmp (請見步驟三、4)

三、pkg-config: command not found

四、Perhaps you should add the directory containing ‘librtmp.pc’ (注:須要有 /usr/local/lib/pkgconfig/librtmp.pc)

 

 

 

我使用的可行解決方案步驟:

一、首先下載解壓ffmpeg;

二、下載librtmp:http://rtmpdump.mplayerhq.hu/ (參考:http://bbs.chinavideo.org/viewthread.php?tid=8002

三、cd至rtmpdump目錄,將文件/rtmpdump-2.3/librtmp/makefile中的-soname 改成 -dylib_install_name;(這裏可能會涉及到權限問題,此時能夠切換爲root進行操做,參考:http://blog.yikuyiku.com/?p=3150,另外可能須要安裝pkg-config,參考:http://hi.baidu.com/newdreamllc/item/3be0780d186f0e7abfe97ea4,由於庫是經過pkg-config尋找的,下載地址http://code.google.com/p/rudix/downloads/detail?name=pkg-config-0.25-1.dmg&can=2&q=label:Rudix-2011。還有一種不經過pkg-config的方法我沒試過:http://d2100.com/questions/53589http://blog.csdn.net/glcdw/article/details/7558303

四、make && make install;

相關文章
相關標籤/搜索