Way back in about 2009 or 2010 I remember my buddy installed something called zone minder on an old computer I had and with a few web cams, somehow or another I was able to monitor my coffee shop from home. It was pretty amazing and cool and free and open source.
Fast forward to twenty-twenty-something, I was messing around with some home automation stuff with nymea and I wondered if perhaps Zone Minder would somehow connect to this. I thought, like usual, there is no better way to find out than to simply quickly try.
In the usual long-hand way, I will now write a bunch of crap as I go through the journey. Reminder: my style is to write as I go so it is not the useful tutorial style but hopefully when I’m done it might also double as that. I’m too busy to edit much so you can feel free to leave if you don’t like my content or style, haha. Without further adoo, here we go…
Setting up the Zone Minder Portable Machine for Testing
First, I wanted to test this with zone minder isolated and running by itself and also portable. Thankfully, I had just learned how to create a USB ubuntu system with persistency which should allow zone minder to run on the USB and also save video files and that kind of stuff if I want / need. I will follow my own blog on creating a persistent usb drive to do that now. Assuming Ubuntu is set up on that new drive, we shall continue.
Setting up BeeBeep LAN chatting software
I love beebeep software. It allows me to communicate text to any other ubuntu machine in my LAN without having to install anything. It just detects any other machine running BeeBeep on your LAN. This is useful for if/when you need to send error messages, or anything else to your main computer. Hence, I just quickly set it up right away. You can just go to the software center and install, too.
Installing Zone Minder on the Portable Testing Machine
Now that I have ubuntu running on the USB drive and can take it where ever I want, it’s time to install Zone Minder. Those steps are written right here in the documentation for setting up Zone Minder on ubuntu
The one thing that seems to hit me every time I do a setup like this is the source repository ‘universe’ restriction in ubuntu. As soon as I reached
sudo apt install zoneminder part I was met with the usual list of unmet dependencies such as follows (and thanks for beeBeep that I can quickly send this text to my main computer for this blog):
The following packages have unmet dependencies: zoneminder : Depends: libavcodec58 (>= 7:4.4) but it is not installable Depends: libavformat58 (>= 7:4.4) but it is not installable
So, what I do is:
- Hit the super key
- Type ‘software’
- Open ‘software and updates’
- Under Ubuntu Software’ tab make sure ‘Community-maintained free and open source software (universe) checkbox is checked
- Close the window
- Reload when requested
Now go back and
sudo apt install zoneminder
Testing Zone Minder
After following all the steps in the zone minder setup for ubuntu page, you should now be on the console page at http://hotsname_or_ip/zm.
If you don’t know how to find that IP you can do it by
sudo apt install net-tools
- Note your local ip address beside appropriate connection such as inet
- Put that into your url above such as https://18.104.22.168/zm
Once you land on the first page there is a overview of project and license etc. You can click ‘apply’ to accept it.
Now that you are on the console page you want to try a video stream to make sure it’s working. And, not gonna lie, there is a learning curve. I had to go back to Zone Minder College before I could get things working, but it’s not too bad to get to a quick testing state with a web cam.
First, here is a nice resource video to get a really good overview of Zone Minder in general. If you have time, I’d recommend starting at 16m 15s (after installation) and letting the author walk you through.
To skip straight to the point of getting your test environment web-cam going (ie. built in laptop camera), you can watch this setting up a webcam on localhost ubuntu machine video. This is a very exhaustive video so you can even skip it if you want and just use my summary here if you’d like but he does a good job explaining the details so if you have time I’d recommend it.
However, they didn’t have the commands in the shownotes so here they are to save you the searching / typing:
- Tell your ubuntu machine to allow Zone Minder (www-data user) to be able to access your USB camera that’s plugged in with this command:
sudo usermod -a -G video www-data
- Restart Zone Minder service to save change:
sudo systemctl restart zoneminder
- Find out your camera’s device path:
ls -al /dev/video*
Note: mine had /video0 and /video1 so not sure why there were two, but I used the first of the two as they appeared (in this case zero) and it worked)
Here are the Zone Minder settings that I used for my logitech Logi and built in laptop cam (they both worked simultaneously, by the way):
- Name: renamed to something appropriate
- Source type: change from ffmpeg to ‘local’
Source Tab: this info is obtained from the
ls -al /dev/video* command above
- Device path: /dev/video0 (for me – adjust yours accordingly to that output device path above)
The rest of video above is great to learn more but if you just want to do a quick and dirty test, just leave evertything as default except that one.
Boom. Your cam should be at least going.
That terminates this blog post on getting Zone Minder going with a simple web cam on a persistent ubuntu USB drive. I am very happy that Zone Minder is not only still going well but has improved many leaps since.
My plan is to see if I can somehow connect this system to my nymea.io system too…