使用vlc将mp4流式传输到html浏览器 [英] Streaming mp4 with vlc to html browser
问题描述
我将网络摄像头图片(没有声音)流式传输到html页面时出现问题。我正在使用最新的(v2.0.2 vlc for windows)进行流式传输,这是命令行:
I have problems streaming my webcam picture (without sound) to a html page. I'm using the latest (v2.0.2 vlc for windows) for streaming, here's the command line:
"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummy dshow:// --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) ,我可以看流,但是当我试图将它嵌入网页时,我什么也看不见!这是代码:
when I open the stream in another vlc player (http://127.0.0.1:8080/webcam.mp4), I can watch the stream, but when I'm trying to embedding it to a webpage, I can see nothing! here's the code:
<!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>
我试图在浏览器中打开它:
Than I'm trying to open it in the browser like:
file:///C:/videostreaming/video.html
我在chrome示例中看到的是,有网络流量,流正在下载,但没有显示。
What I can see in chrome example, is that there's network traffic, the stream is downloading, but nothing displayed.
推荐答案
你无法使用VLC通过http协议传输mp4
You can't transmit mp4 over http protocol using VLC
点击此链接查看输出方法/多路复用矩阵
http://www.videolan.org/streaming-features.html
Follow this link to see the Output method / muxer matrix http://www.videolan.org/streaming-features.html
但是你可以尝试转码为ogg。
However you can try to transcode to ogg.
试试这个:
"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummy dshow:// --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视频标签:
and in your html video tag:
<source src="http://127.0.0.1:8080/webcam.ogg"/>
这篇关于使用vlc将mp4流式传输到html浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!