視訊流 – 流媒體mp4與vlc到html瀏覽器
我的網路攝像頭影象(沒有聲音)流向html頁面時遇到問題.我使用最新的(v2.0.2 vlc for Windows)進行流式傳輸,這裡是命令列:
"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummydshow:// --dshow-vdev="Logitech QuickCam Chat" --dshow-adev=none --dshow-caching=0 --sout=#transcode{vcodec=h264,vb=1024,channels=1,ab=128,samplerate=44100,width=320}:http{mux=ts,dst=:8080/webcam.mp4}
當我在另一個vlc播放器(http://127.0.0.1:8080/webcam.mp4)中開啟流時,我可以觀看流,但是當我想嵌入到一個網頁時,我什麼都看不到!這裡是程式碼:
<!DOCTYPE html> <html> <head> <title>Video Test</title> </head> <body> <video id="video" class="projekktor" autoplay="autoplay" width="300px" preload="metadata"> <source src="http://127.0.0.1:8080/webcam.mp4" /> Your browser doesn't appear to support the HTML5 <code><video></code> element. </video> </body> </html>
比我試圖在瀏覽器中開啟它:
file:///C:/videostreaming/video.html
我可以在chrome示例中看到,是網路流量,流正在下載,但沒有顯示.
您不能使用VLC通過http協議傳輸mp4
按照此連結檢視Output方法/ muxer矩陣
ofollow,noindex" target="_blank">http://www.videolan.org/streaming-features.html但是你可以嘗試轉碼為ogg.
嘗試這個:
"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummydshow:// --dshow-vdev="Logitech QuickCam Chat" --dshow-adev=none --dshow-caching=0 --sout=#transcode{vcodec=theo,vb=1024,channels=1,ab=128,samplerate=44100,width=320}:http{dst=:8080/webcam.ogg}
並在您的html視訊標籤中:
<source src="http://127.0.0.1:8080/webcam.ogg"/>
程式碼日誌版權宣告:
翻譯自:http://stackoverflow.com/questions/11294836/streaming-mp4-with-vlc-to-html-browser