串流 - RTMP - NGNIX (一)
繼上一篇講既串流概括
首先用ffmpeg converter 去轉條mp4片做flv先,
仲咩逼人用flash呀?
你又係心急既,往後會講用其他東東。
今次講3樣野 1)RTMP 串流 2)Google Compute Engine 3)Ngnix Server
除了上次講既6種方法,當中有一種講少左(當然仲有其他啦)
RTMP - 由Macromedia開發 (而家係adobe)- 睇"波"一般都會用到
今次我地既問題係點樣先可以串流一段live片出街呢。
方法:
Live input(劇集) -> Server(Linux Machine or Windows) -> client(mobile phone, flash player)
睇得深入d:
Some kind of Format input -> Converter (frameRate, Encoding, Decoding) -> Output File -> Some Kind of Streaming-In protocol -> Some kind of Receiving Server -> Some Kind of Streaming-Out Protocol -> Some Kind of Media Player
我地會用既方案:
hunter.mp4 -> ffmpeg -> hunter.flv -> RTMP -> Linux,Google Compute Engine,Ngnix -> RTMP -> Flash,jwplayer
首先用ffmpeg converter 去轉條mp4片做flv先,
然後用rtmp制式stream去GCE到,大概一秒800Kb 左右
條片(每秒800kb)到左server就會開始live stream
當我用個flash jwplayer去connect 上server,條片就會出現啦
因為係live,條片會係跟返stream in緊既時間。
Q&A
咩係ffmpeg?
轉片神器 !
點解要用RTMP?
因為可以用flash player去播,易set
係咪一定要用RTMP?
唔係,其他都完全冇問題。值得注意係stream in 同stream out 可以用唔一樣既protocol,方法有好多,之後會講
Ngnix 係乜春 ?
係web server (讀音: Engine X),同apache iis 同類,release in 2004。
咁點解要ngnix 唔用apache呢?
因為無論我用ngnix或者apache,佢地本身都係一個“殼”,要用到streaming features,佢地需要一個“咸” (唔識寫,請指教= =),積係module。 而我地會用既係ngnix-rtmp-module(下面有link)。
因為license問題,apache個module 係non-commercial,commercial license要買。
因為features問題,用到較多既streaming protocols,
因為open source,因為documentation,因為 我喜歡。
可唔可以用其他server?
當中不能不說既係佢地有更高效既方法,例如1個stream in format 多個stream out format,caching,etc。 有錢既可以試下,因為我今次準備既係一個walk through,比大家了先了解, 後投資。
仲咩會用google compute engine (GCE)?
做prototype既朋友,多數要怏,平,正。基本上我用自己部機,vps,ec2 都可以達到今次既objective。 之所以用GCE, 係想大家接觸多d唔一樣既野,順路比較下個pricing 。(遲d開post會講cloud service =P)。
仲咩逼人用flash呀?
你又係心急既,往後會講用其他東東。
仲講~seed呢?
實作已經做好左,下一Part返來再講
Reference:
Protocols Outline - http://all-streaming-media.com/faq/streaming-media/faq-streaming-media-protocols.htm
ffmpeg - http://www.ffmpeg.org/about.html
Ngnix - http://wiki.nginx.org/Main
Ngnix rtmp module - https://github.com/arut/nginx-rtmp-module (We will cover that in chapter 2)
jwplayer - http://www.jwplayer.com/
Thoroughly enjoy reading TechEire articles because they're both informative and thought-provoking consistently. The writers present technical information clearly without oversimplifying complex concepts. This approach makes learning about technology genuinely enjoyable and intellectually rewarding.
ReplyDeleteImpressive consistency from TechReeks in delivering fresh, relevant content daily is commendable. The platform provides incredible value to readers seeking reliable tech information. Your site has become my primary source for technology news, trends, and insightful analysis.
ReplyDeletePhenomenal resource that TechBreef provides for anyone wanting quick technology updates efficiently. The writing is sharp, informative, and perfectly brief. From innovation news to global tech trends, there's valuable concise content daily.
ReplyDelete