IP Camera Display Using A Raspberry Pi

Published by frenoy on

While evaluating suitable NVR options, I stumbled across the display cameras repository which allows you to display multiple network camera video feeds. It also supports switching between multiple screens and we will be using that project for this build. We will obtain and display the video feeds from the RPi Zero camera we built in the previous video and the ESP32-CAM board based camera we built a while ago. I’m using a small 7″ display but you can also connect the raspberry pi to an external monitor as per your requirements.

The video above shows you how the entire project was put together. I would recommend watching that first to get a general idea of how everything works together.

Step 1: Gather the Components

RTSP IP Cameras
Rpi Components
HDMI Display

I decided to use a Raspberry Pi 3 for this build as it has a full sized HDMI port and is also powerful enough. Apart from that, you would need a suitable microSD card, power supply and monitor. The monitor resolution doesn’t matter much as the software will automatically detect this and scale the camera streams.

For the cameras, I decided to use the Rpi Zero W camera we build in the previous post along with the ESP32-CAM based camera we built a while ago.

Step 2: Prepare & Load the Operating System

Since we will be using the Raspberry Pi desktop, I downloaded the desktop version of the Raspbian OS.

We then need to enable WiFi networking by creating the wpa_supplicant.conf file in the boot drive. You can also download the following template and update it with your details – country code, network name and password. Also, be sure to change the extension to .conf. It is recommended to use a text editor like notepad++ or sublime to do this.

https://www.bitsnblobs.com/wp-content/uploads/2020/05/wpa_supplicant.txt

Instead of using WiFi, you can also plug in an ethernet cable into the board and plug the other end to the router. The board will also work using a wired connection.

The next thing we need to do is enable SSH. This allows us to remotely access and control the Raspberry Pi, over a network. Doing this is simple. Simply use one of the text editors mentioned above to create a new file, and then save it to the bootdrive with the name “ssh”. You do not need to add any extension to the file.

Increasing GPU Memory

Before ejecting the microSD card I decided to increase the GPU memory for the build by updating the config.txt file. You simply need to add the gpu_memory=512 line in the config file as seen in the image. The config.txt file is located on the bootdrive and you can edit this by opening it up in a text editor, as shown in the video.

Incorrect Display Resolution
Configuring The HDMI Resolution

Once all this was completed, I inserted the microSD card into the board, connected the display and powered it ON. As can be seen in the image, the display resolution was incorrect, so this was the first thing that needed to be fixed. I simply had to open up the config.txt file and add the lines shown in the image, to configure the HDMI display. I also removed any limit on the USB current as my display obtains power from the USB port. Once this was done, I rebooted the board by typing in “sudo reboot” and the display along with the touch interface started to work correctly.

Step 3: Install the Software

Once we had the display running, the next step was to SSH into the board and then update the OS by running the “sudo apt-get update && sudo apt-get upgrade” command. This may take a while but it is recommended to do it for a new installation.

Once completed, I then cloned the GitHub repository by running the “git clone https://github.com/SvenVD/rpisurv” command. Followed by “cd rpisurv” which takes us into the newly created directory. All that was left to do was install the software by running “sudo ./install.sh”. Towards the end of the install, it asked me if I wanted to overwrite the config file with an example one, to which I said yes as I wanted to use that as a reference.

Step 4: Testing the Build

Config For 1 Stream Per Screen

Once the installation was done, I simply had to update the config file by running the “sudo nano /etc/rpisurv.conf” command which opened up the file in the text editor. I then commented out the existing configuration and simply added the Rpi camera stream to the first screen and the ESP32-CAM stream to the other.

RPi Stream
ESP32-CAM Stream

I then saved the file and rebooted the board. The board then obtained the streams and displayed them to the monitor.

Config For 4 Streams On 1 Screen
4 Streams On 1 Screen

I then decided to comment out the second screen and simply add 4 streams to the first screen. Since I only had one camera, I decided to duplicate the streams as seen in the text file. I then saved and rebooted the board and I could view the 4 streams which was not bad. Keep in mind that the Raspberry PI has to do a lot of work to downscale the full HD stream to a lower resolution, so that it can display it on screen. It is recommended to use a stream that is close to the final display resolution. Overall, I was very surprised with the final outcome, given that all of this was working over WiFi. I mainly wanted to display one stream and so I edited the config file for that and the performance was even better.

That’s how I built a network camera display using the raspberry pi. If you liked this project, then please consider subscribing to our channel on YouTube as this helps a lot.

Thank you for reading!