Display live video on your PRTG map

 Originally published on June 19, 2020 by Simon Bell
Last updated on July 01, 2020 • 16 minute read

Those of you who are familiar with PRTG Network Monitor know that it’s great for monitoring CCTV systems. We’ve published articles and “How To” guides on the subject, and we’re technology partners with leading camera manufacturers such as Axis.

When talking to customers about monitoring their CCTV systems, one of the most common questions is “How can I display live video on my dashboard / in PRTG maps?

Unfortunately, while the question may be simple, the answer isn’t. If you want to learn more about video standards and protocols, and why adding a live video stream to a web page (remember, a PRTG map is just a web page) is so difficult, then just read on.

iIf you want to jump directly to the step-by-step instructions for setting up your CCTV live video in PRTG Maps, click here.

Background information about video standards, protocols and necessary conversion for web view

It’s all to do with standards and protocols. In the world of video, there is a huge variety of protocols and streaming standards, with different manufacturers each adopting different ones – some are not even consistent across their own product range! At the low end of the market, it’s not uncommon for cameras to need proprietary browser plugins, often based on Java or QuickView, to allow feeds to be viewed (possibly not the greatest idea for a security system).

Once you get to mid-range camera systems and above, the manufacturers are more likely to embrace generic standards. But unfortunately, that doesn’t simplify things much. The first problem is that there are many different video formats – as many as 3,000 by some estimates. Many of these are the proprietary ones mentioned above. But there are still literally hundreds of “standard” video formats available for manufacturers to use. This article provides more information and some useful background to the minefield of video standards.

In reality, things aren’t quite as bad as they first appear. Most manufacturers will support at least one of the three main codecs (formats) – H.264 (aka MPEG4, Part 10), MJPEG or MP4 (aka MPEG4, Part 14). We don’t have the space here to discuss the relative merits of the different protocols – the web is awash with information, and entire books have been written on the subject, if you want to delve deeper.

Don’t cross the streams!

Even once you’ve settled on the video codec to use, we’re still not ready to embed video on our PRTG map. We now need to get the video feed from the source device into PRTG. To do this, we need to stream the video feed. Most camera, NVR (Network Video Recorder) and VMS (Video Management System) vendors support RTP or Real-time Transport Protocol and its corresponding control protocol RTSP (Real Time Streaming Protocol). Again, a detailed discussion of these protocols falls outside the scope of this article. But please go ahead and do some research, if you feel the need for more acronyms in your life.

The problem with RTP is that it can’t be embedded directly into our PRTG map, so first we must convert the stream into something that CAN be. I made the best experiences with the Theora video format, encapsulated in an Ogg container.

To make this format conversion we need to use a third-party tool. There are many options available for this, but my preference is the rather excellent, open source VLC Media Player, available for Windows, Linux, OSX and others. Whichever transcoding tool you choose, it needs to be running permanently to continuously convert the camera feed – I discuss this in more detail later in the article. For resource reasons, we don’t recommend installing it on your PRTG server. But, as long as the transcoding tool is reachable on the network, all should be good.

Many people know VLC for its ability to play pretty much any type of media file without needing to manually add any codecs. But VLC is far more than a simple media player. Dig a little deeper into its menus and you’ll find a very capable and sophisticated media processing tool, capable of transcoding source files, or streams, into different formats.

How to setup the stream conversion

OK, this is where the practical part starts. If you've gotten through the theory part, congratulations, everyone who jumped right in here, a warm welcome. Here we go...

 

First, you need to make sure your camera, control system or network video recorder is set to deliver an RTSP stream. How to do this will vary from system to system, but when using a Unifi CCTV camera, you enable the stream from the Manage tab.
live-video-in-prtg-maps-01
 
Streams can also be retrieved from video control systems. Again, specifics will vary by platform, but here’s an example of available streams from a Synology Surveillance Station controller.
live-video-in-prtg-maps-02
 
Once you’ve found the RTSP stream URL, copy it to your clipboard. Now that we have the stream source configured, we need to tell VLC where to find it and how to transcode it. Once VLC is installed and running, click MediaOpen Network Stream.
live-video-in-prtg-maps-03
 
On the Network tab, paste the stream URL into the dialog box, and select Stream from the destination dropdown box.
live-video-in-prtg-maps-04
 
From the Destination Setup panel, select HTTP from the drop down and click Add
live-video-in-prtg-maps-05
 
On the HTTP settings tab, select an unused port number and click Next.
live-video-in-prtg-maps-06
 
On the Transcoding page, make sure Activate Transcoding is enabled 😉 and click the spanner (wrench) icon. – Don’t worry about the default setting in the PROFILE box, we’re about to change it.
live-video-in-prtg-maps-07
 
On the Encapsulation tab, select the Ogg/Ogm button
live-video-in-prtg-maps-08
 
On the Video tab, enable Video and select Theora from the Codec dropdown.
live-video-in-prtg-maps-09
 
On the Audio and Subtitle tabs, disable both options. Then click Save. You will be returned to the Transcoding Options page, which should reflect the changes you made.
live-video-in-prtg-maps-10
 
Click Next. VLC will now present a summary of the transcode settings. Keep a note of these as they can be used as parameters when running VLC as a service (more on this later).
live-video-in-prtg-maps-11
 
Click Stream, and VLC should start displaying the feed from the configured source.
live-video-in-prtg-maps-12
 

The PRTG bit

As VLC is transcoding the original RTSP stream into an HTTP stream, we can now add that to a PRTG map using a custom HTML object.

live-video-in-prtg-maps-13

The HTML code looks like this:

<video id='video' src='http://xxx.xxx.xxx.xxx:yyyy' autoplay='autoplay' width='400' height='300'></video>

Where xxx is the IP address of the machine running VLC and yyyy is the port number chosen during the stream configuration.

Carry on streaming

I mentioned earlier that the transcoding tool must be running permanently to convert the video stream. Of course, you could just run the GUI version of VLC on a networked machine, but that’s not very convenient. Fortunately, there are a couple of solutions we can use. For those who prefer the Windows environment, you can configure VLC to run as a Windows service. For Linux users, VLC includes a CLI executable, called CVLC, which can be called from a shell script, and set to run at boot time with a Cron task.

There are some minor differences in the parameters required by the versions for the different operating systems, but in general, you need to specify the RTSP source, the transcoding options and the destination format and port.

These parameters are a little convoluted, but fortunately we made a note of them when first testing the transcoding (You DID make a note of them, didn’t you?).

For example, my shell script to run CVLC looks like this (ignore the line break):

live-video-in-prtg-maps-14

Explanation:

rtsp://1x.xxx.xxx.xxx:7447/xxxxxxxxxxx the stream source being sent from the Unifi camera
--sout '#transcode{vcodec=theo,vb=800,scale=Auto,acodec=none,$=none,scodec=none} the transcode settings from the Option Settings dialog box of the GUI setup
http{mux=ogg,dst=:8089/}' destination format and port

Although a little complicated, this method will allow you to embed live video feeds into your PRTG maps. And while it’s no substitute for a dedicated multi-camera CCTV control system, it could be very useful for adding a stream from a camera in a server room, or outside a security door, to a PRTG map.

Your feedback is appreciated

Do you already use live feeds in PRTG maps? Or have you configured it via this instructions? Share your experience with us in the comments!