Raspberry Pi Video Surveillance Monitor

This post may contain affiliate links. Please read my disclaimer for more info.

Have video cameras around your home and property for home defense? Have an easy way to display them? In today’s article, I’m going to walk through turning a Raspberry Pi into a video surveillance monitoring system. You can hook up the Raspberry Pi to your TV or any other monitor you have lying around to create your very own video surveillance system.

I recently bought a Ubiquiti camera and set it up to monitor my house. While I can always view the camera through the UniFi Video app or through my NVR, I wanted an easy way to open up the feed if my phone was dead or in another room. I’ve now turned one of my HDMI ports on my living room TV to an awesome video surveillance monitor that anyone can use, just using a Raspberry Pi. Using the software from today’s article you can create grids or do fullscreen streams including rotating through several different cameras.

TV Surveillance

Setting up Raspberry Pi

If you don’t have a Raspberry Pi already I recommend this kit from CanaKit which comes with an excellent power supply. Pair it with the SanDisk Extreme Pro for an awesome microSD card that is fast and reliable.

First off, go ahead and download the latest version of Rasbpian. I like to do the “Raspbian Stretch Lite” install so that I don’t have any extra packages installed. Etcher is a great cross-platform tool to write the image to an SD card. After writing the image to the SD card, I like to automatically enable ssh. Create a blank file named “ssh” or “ssh.txt” in the “boot” partition if you want your Raspberry Pi to already have ssh enabled. You don’t really need to do this though if you’ll be plugging it into a TV or monitor to complete the setup.

Configuring the Pi

Boot up the Raspberry Pi. We need to make a few changes to the configuration to improve performance. There is a tool preinstalled called raspi-config which offers a graphical way to tweak the operating system. Launch the config tool by running sudo raspi-config over an SSH connection or using the local keyboard/monitor.

A graphical menu should pop up that you can now use.

Raspberry Pi Config

We want to change the following:

  • Boot Options -> Wait for Network at Boot
  • Localisation Options -> Change Timezone -> (Choose your timezone)
  • Interfacing Options -> SSH -> Yes
  • Advanced Options -> Expand File System
  • Advanced Options -> Memory Split -> 256

The “Wait for Network at Boot” option will have the Raspberry Pi wait for a network connection before completing the boot process. Since this Pi will be used for monitoring video feeds over RTSP it makes sense to wait for the network to be up before launching the feeds.

The “Expand File System” option just resizes the filesystem on the next boot to use the whole SD card. Finally, changing Memory Split to 256 gives more memory to the GPU (Graphical Processor Unit). Because we’re processing video streams, it makes sense to give more memory to the GPU.

Now run updates for the Pi and reboot.

Getting RTSP Streams

Video cameras can stream their video over the Real Time Streaming Protocol or RTSP. You’ll need to refer to your camera’s documentation to determine if it supports RTSP and how to get the stream URL. I recently invested in the Ubiquiti Networks camera system and set up their UniFi Video NVR. So I’ll be detailing how to get streams for my ecosystem.

On your UniFi video server you’ll want to go to your settings and turn on the RTSP streaming port.

Turn on RTSP

Then, go back to the “Cameras” menu, click on your camera and look for the RTSP Service section a the bottom of the video tab. Turn on one or more of the RTSP service streams for the camera. I’ll talk more in the next section about how to choose the right one.

Turn on Camera RTSP

You can test out the RTSP stream by pasting it into VLC media player. First, in the VLC preferences go to “Input / Codecs” tab and near the bottom choose “RTP over RTSP (TCP)” as the Live555 Stream Transport option. Then you’ll be able to copy your RTSP stream URL into VLC’s “Open Network Stream” window to open the network stream for the camera.

VLC Camera Stream

Repeat for all the cameras you’ll want to display. Once you’ve confirmed all your RTSP streams are working move on to the next section to install displaycameras and get it up and running!

Installing displaycameras

Now we’ll move back to the Raspberry Pi to begin setting up the actual displaycameras package. displaycameras is a piece of software that will pull in the RTSP feeds and create a grid for display. It repairs streams continuously so if you’ve ever had a problem with streams drifting, this software automatically fixes that. To get started, download and extract the software on your Raspberry Pi.

Now, make the installer executable and run the install script. When asked about the custom GPU memory split just press “Enter” to accept the default. After it is done installing, it will prompt you to see the README.md.


Now the next part of the setup will greatly depend on the monitor and number of cameras you want to display. displaycameras supports screen rotation so you can have it cycle through multiple screens of cameras. In the example_layouts directory, there are several different examples of camera layouts as well as an in-depth document discussing how the layouts work. I recommend reading through my example and the document to get a general idea on how the system works before creating your config file.

I’m going to walk through an 8 camera setup. We want to show the cameras in a 2×2 grid, so 4 cameras at once. Therefore, we need 4 windows that will be on-screen showing 4 different cameras. 4 windows will be off-screen showing 4 more cameras that can’t actively be seen. Look at the diagram below for a visual demonstration.


Every 5 seconds the camera in window 5 will move to window 4 and the camera from window 4 will move to window 3 and so on. This will create an effect of rotating cameras through the visible display. For an 8 camera solution, you could also have a 3×3 grid with a blank space and no rotation. displaycameras is very customizable for whatever makes sense in your environment.

Configuration Files

We need to configure two files for our setup. The first is in /etc/displaycameras/layout.conf.default so you can edit it launching nano, vim or your favorite text editor while running an SSH session. There are 5 variables we need to set in this file, windows, window_positions, camera_names, camera_feeds, and rotate.


First, let’s set windows and window_positions. These define the windows and where they sit on the display. I’m using a 1920 x 1080 display so the off screen windows will all be on the X-Axis past 1920 pixels. These two variables should have the same number of entries. The window_positions entries are in the form "start_x, start_y, end_x, end_y". With 0, 0 being the pixel in the top left of the screen. All eight windows are 960 x 540 pixels.


Next, we can set the camera_names and camera_feeds variables. These basically name the cameras and the RTSP streams. If your camera supports multiple RTSP streams for different resolutions choose the one that most closely matches the resolution you’re targeting. Since each window in my display is 960 x 540 I’m going to go with the medium quality stream which streams at 1024 x 576. You basically want to choose the stream resolution that minimizes the scaling the Raspberry Pi has to do.

Finally, set the rotate variable to true if you need to rotate cameras, else you can leave it off or set it to false.

The next file to edit is located at /etc/displaycameras/displaycameras.conf. There are some interesting options in this file to change the time of the rotating cameras, detecting display resolution and camera timing. The defaults worked great for me so I didn’t need to make any edits, but it’s worth reading through to learn more about additional options.

After your configuration is done restart the service by issuing sudo systemctl restart displaycameras.service. This may take a while, but once it finishes your cameras should be displaying and the rotation timer will start. The service automatically runs on boot so you don’t need to worry about starting it manually.


If you’ve got cameras that support RTSP you owe it to yourself to set up a Raspberry Pi to display them! This tutorial should get you started and get your video surveillance monitoring system up and running. The great thing is that Raspberry Pi can be plugged into your TV, a computer monitor mounted in a hallway or just about anywhere. Let me know if the tutorial worked for you or if you’re using other software besides displaycameras to showcase your RTSP feeds. I’m also interested in other cameras people are using!

Remember to follow Self Hosted Home on social media and subscribe to our email list to get the latest blog updates. I plan on doing lots more in 2019!