使用VLC搭建ApsaraVideo for Live伺服器

來源:互聯網
上載者:User

去年我們資訊之夜我們進行過ApsaraVideo for Live服務,當時我們使用了WMS(Windows Media Server)實現了這個服務,但是編碼是微軟的WMV,因而像iPhone/Android這樣的智能手機無法觀看,今天我給大家帶來一種更簡便的實現方式,並協助所有平台使用者都可以觀看。

首先介紹一下,今天我們的工具VLC Player。

VLC首頁:http://www.videolan.org 

VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols.

VLC不僅僅是個播放器,也可以作為流媒體伺服器使用。這個網上有相關的資料,我就不多說了。

聲明下本文用的VLC版本:2.0.3

服務端操作

開啟“媒體——流”選項,:

點擊“擷取裝置(D)”選項卡,選擇“捕獲模式”——“DirectShow”,“適配裝置名稱”——“Integrated Webcam”(或者你的網路攝影機、攝像機),“音訊裝置名稱”——“內建式麥克風(IDT
High Definition)”(或者是你的外置麥克風),然後點擊“串流”按鈕。


點擊“下一個”後,在“目標設定”介面選擇“HTTP”,然後點擊添加按鈕


填上目標ip地址,並在“轉碼選項”中選擇相應的編碼類別型


用戶端操作

點擊“媒體——開啟網路串流”,在彈出的框中輸入“http://127.0.0.1:8080/xxzy”,點擊“播放”按鈕即可。


命令列操作方式
服務端:

[plain] view
plaincopy

  1. vlc :sout=#transcode{vcodec=h264,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ts,dst=:8080/xxzy} :sout-keep  


用戶端

[plain] view
plaincopy

  1. vlc http://127.0.0.1:8080/xxzy  


VLC除了可以使用HTTP協議發布,還可以使用RTP、RTSP、UDP發布,大家可以自己嘗試。

 

 

 

 

下面是 RTP 的點播測試

1.vlc --ttl 12 -vvv --extraintf=logger --color -I telnet --telnet-password admin --rtsp-host 0.0.0.0:5554
3.telnet localhost 4212  admin
4.點播服務vod
new vod1 vod enabledsetup vod1 input /var/www/Videos/huangshan.ts  驗證:rtsp://127.0.0.1/vod1
5.組播伺服器
new ch1 broadcast enabledsetup ch1 input /var/www/Videos/kangshifu.ts loopsetup ch1 output #duplicate{dst=rtp{dst=226.0.0.6,mux=ts,port=1234}}control ch1 play
control應用:play,stop,pause,see
驗證:rtp://@226.0.0.6:1234

new ch2 broadcast enabledsetup ch2 input /var/www/Videos/Sea.ts loopsetup ch2 output #duplicate{dst=udp{dst=226.0.0.7,mux=ts,port=8007}}control ch2 play
control應用:play,stop,pause,see
驗證:udp://@226.0.0.7:8007


6.儲存剛才操作
save /var/www/vlc.cfg  load /var/www/vlc.cfg 

 

聯繫我們

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