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.
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.
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.
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...
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.
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.
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):
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.
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!