Alles over…
Alles over…

ZoneMinder and Raspberry Pi Zero birdcam (update)

In the previous birdcam article I wrote about using mjpg_streamer to get my bird camera in ZoneMinder. That made sense since Zoneminder was separate images as frames originally.

I recently updated my ZoneMinder installation and it has now the ability to store MP4 files using H264 so it makes sense to update my stream also using the encoding. Unfortunately I have to step away from mjpg_streamer as the support for that is not functioning.

After some investigation I decided to go for UV4L as software (UV4L stands for User Video 4 Linux). It has evolved over the years and now optionally includes a generic purpose Streaming Server plug-in, especially made for IoT devices such as Raspberry Pi Zero.

Installation on Raspbian Stretch as follows (read my previous article to get information on installing etc.):

Add the PGP key of the UV4L packages source to your trusted list:

curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -

Add the following source line to the following line to the file /etc/apt/sources.list:

pi@raspberrypi:~ $ sudo vi /etc/apt/sources.list
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main

Next update your system and install packages:

 # Making sure your system is up to date
sudo apt update && sudo apt upgrade
# Installing or upgrade to the latest version of uv4l
sudo apt install uv4l uv4l-raspicam 

Since we also want the driver to be running at boot

sudo apt install uv4l-raspicam-extras
This way we can start, stop, restart or check the service using
pi@raspberrypi:~ $ sudo service uv4l_raspicam start/stop/status/restart

The service will be using the configuration file /etc/uv4l/uv4l-raspicam.conf to load the default values for the driver and the server options. We will edit that file to enable H264 streaming since it is defaulting the mjpeg.

Additionally I also want the server to be installed.The purpose is that I get a real time HTTP service using the UV4L libraries.

sudo apt install uv4l-server

At this time (after restarting the uv4l-raspicam service) you should already have a streaming server running on port 8080. It an MJPEG service and I want a raw H264 stream. Therefor modifications to the configuration file (uv4l-raspicam.conf) need to be made. The server also has a control panel reading the config file and allowing you to change parameters. Default it does not allow you to write back though. I don’t mind since it will overwrite my settings again but it is good for testing.

pi@raspberrypi:~ $ sudo vi /etc/uv4l/uv4l-raspicam.conf
Add/modify/uncomment the following settings in that file:
encoding = h264
width = 1296
height = 968
framerate = 15
profile = high
intra-period = 4
inline-headers = yes

Profile, intra-period and inline-headers are H264 parameters.

Adding your stream to ZoneMinder

Now that we have a stream available we can start integrating in ZoneMinder. In the ZoneMinder console add a new camera. Add a name and set Source Type to ‘Ffmpeg’ in the General tab. In the Source tab set Remote Method to ‘TCP’ and in Source Path enter http://birdcam:8080/stream/video.h264. Set the Capture Width and Height to the values of your stream. In above example 1296 x 968.
Since I also want to store video in MP4 format I adjust the Video Writer setting in the Storage tab to X264 encode. That will store the videos as MP4 file.

That should do the job and you can continue setting the other required parameters for your stream. I added some straw stuff in the box so the Cup-a-Soup carton is not visible anymore.

ZM General settings

ZM Source settings

ZM Storage settings

More visits

Luckily even in winter time a great tit was again investigating the birdcage. You can see the difference compared to the previous video. After the video I adjusted the intra-period setting down to 4 since I had artifacts as you can in below video

Een reactie plaatsen

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

6 gedachten over “ZoneMinder and Raspberry Pi Zero birdcam (update)”