Upcoming Maintenance Alert:

The UBNT Community will be upgraded at 5pm MDT on April 25th. During this time the community forums will be set to read-only status.

Learn more

×
Reply
Highlighted
New Member
Posts: 29
Registered: ‎02-19-2016
Kudos: 2

Transcoding RTSP to multiple streams for HTML5 with VLC

Hello

 

I'm trying to stream to a homepage from G3 camera, and it works semi. I have a dedicated server and now I run both the Unifi-video on it an VLC transcoding on it.  I wan't to transcode to ogg, mp4 and webm. Ogg works fine.

mp4 seems to not work so good, and webm transcoding uses lot of cpu power, so I think my settings are somehow not optimised. This is only for small block on my site, so I don't need much bandwith. 

 

This is the code in script format as I run it now, but I have shut down webm as it uses really much CPU.

 

#!/bin/sh
cvlc -I dummy --loop rtsp://192.168.1.22:7447/5a230d564f0c1e8257603866_2 --sout '#transcode{vcodec=theo,vb=500,acodec=none}:http{mux=ogg,dst=:8082/skeet_live.ogg}' --sout-keep &
cvlc -I dummy --loop rtsp://192.168.1.22:7447/5a230d564f0c1e8257603866_2 --sout '#transcode{vcodec=h264,vb=500,acodec=none}:http{mux=ts,dst=:8083/skeet_live.mp4}' --sout-keep &
cvlc -I dummy --loop rtsp://192.168.1.22:7447/5a230d564f0c1e8257603866_2 --sout '#transcode{vcodec=VP80,acodec=none}:http{mux=webm,dst=:8084/skeet_live.webm' --sout-keep &

To show it on my homepage, I have this <video> block on a sidebar, but this is the code for now. I also have a cron job on my server to take a snap from the camer each minute and the page grabs that image if the video does not work.

 

<video id="video"  autoplay="autoplay" width="100%" preload="metadata">  
      	<source src="http://example.is:8082/skeet_live.ogg" type="video/ogg" />
	<source src="http://example.is:8083/skeet_live.mp4" type="video/mp4" />
	<source src="http://example.is:8084/skeet_live.webm" type="video/webm" />
         <img src="example.is/skeet.jpg" title="Your browser doesn't appear to support the HTML5 <code>&lt;video&gt;</code> element." />  
    </video>

Is there something I can do better to let this work on most browsers, and also, why is the transcoding so heavy for webm? 

 

This works like charm for ogg in firefox

 

Best Regards

Magnus

New Member
Posts: 29
Registered: ‎02-19-2016
Kudos: 2

Re: Transcoding RTSP to multiple streams for HTML5 with VLC

<video  autoplay="autoplay" width="100%" preload="metadata" poster="https://example/skeet.jpg">  
      	<source src="http://example.is:8082/skeet_live.ogg" type="video/ogg" />
	<source src="http://example.is:8083/skeet_live.mp4" type="video/mp4" />
	<source src="http://example.is:8084/skeet_live.webm" type="video/webm" /> 
    </video>

Changed the source litle bit, but I found out that poster attribute in video can use the snapshot image, and it shows the image if the video does not load. That is then the newest image from the camera. But It would be great to let this work in mp4 and webm also, as now I'm only running this in ogg.

Reply