Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming mp4 with vlc to html browser

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} 

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>&lt;video&gt;</code> element.  
    </video>
  </body>
</html>

Than I'm trying to open it in the browser like:

file:///C:/videostreaming/video.html

What I can see in chrome example, is that there's network traffic, the stream is downloading, but nothing displayed.

like image 504
balazs Avatar asked Jul 02 '12 13:07

balazs


People also ask

How do I access the HTTP stream in VLC?

To tune in to a stream, click the Media menu in VLC on another computer and select Open Network Stream. Assuming you used HTTP, enter an address like http://IP.Address:8080.

Can I stream a website on VLC?

Open and Play a Stream Make sure you are using the latest version of the VLC player. Click Media on the task bar followed by Open Network Stream. This will open a prompt with a box for the network URL. Type your network URL into this box to retrieve the stream.

Can VLC play HTML5 video?

All you need is VLC video player and web browser, which supports HTML5.


4 Answers

You can't transmit mp4 over http protocol using VLC

Follow this link to see the Output method / muxer matrix http://www.videolan.org/streaming-features.html

However you can try to transcode to ogg.

Try this:

"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} 

and in your html video tag:

<source src="http://127.0.0.1:8080/webcam.ogg"/> 
like image 119
Martin Avatar answered Sep 22 '22 08:09

Martin


try adding the type of video (type="video/mp4"):

<video width="320" height="240" controls="controls">       <source src="movie.mp4" type="video/mp4" />       <source src="movie.ogg" type="video/ogg" />       Your browser does not support the video tag.     </video> 
like image 33
Entrabiter Avatar answered Sep 23 '22 08:09

Entrabiter


you're telling VLC to stream in TS format mux=ts this is your problem, you need to mux in mp4

like image 25
Daniel Hill Avatar answered Sep 24 '22 08:09

Daniel Hill


For live streaming you should use following

<video id="video" src="http://localhost:8181/stream" type="video/ogg; codecs=theora" autoplay="autoplay"/>

More at Here's a link!

Please note: Video type "ogg" only!

like image 21
alba Avatar answered Sep 21 '22 08:09

alba