Monday, June 22, 2009

Linux video surveillance

Since I moved my family to a more populated location, my wife and I decided that we wanted a little more security at home. Obviously, I didn't want to pay $1,000+ for a canned surveillance package that I can't configure or customize myself. I also had an inkling that there would be some open-source software that could do the job.

My googling came up with 3 programs:
eLViS
Motion
ZoneMinder

Of the 3, ZoneMinder appeared the most mature and usable. Motion is probably great if you want to do a lot of custom scripting. eLViS uses Motion as a back-end and has some nice features (like a multi-camera-view panel), but hasn't been updated since 2006.

ZoneMinder has a great WiKi and forum that's quite active. It's available in the standard Debian/Ubuntu software repositories, so I installed it:
sudo apt-get update; sudo apt-get install zoneminder

The biggest dependencies are mysql and apache (yes, those are HUGE dependencies). I had to tweak the Apache config to have it listen on a different port, since I already have the VMWare Server web GUI listening on port 80. Other than that, the installation was turnkey.

The rest of the configuration depends on the cameras you choose. The ZM WiKi has pretty comprehensive support for cameras. My first test was with my webcam, a Logitech Pro 9000. It has its own nuances with the Linux kernel's USB drivers, but works OK as long as you keep it plugged in. Setting it up required installing software to convert a video stream from a UVC device to an http stream, called mjpg-streamer. The simple steps to install are:
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer
cd mjpg-streamer
make clean all
sudo make DESTDIR=/usr install


To start up a stream, use this command:
mjpg_streamer -i "input_uvc.so -r 640x480 -f 20" -o "output_http.so -p 8080" -b

That starts a video stream that you can see with your web browser at this URL. If you want to use a webcam as a long-term monitoring device, then you'll want to put the command above in /etc/rc.local or some other startup script.

Since my test went well, I decided to take it to the next level. I purchased a Panasonic BL-C20A from the cheapest vendor I could find at PriceGrabber and it arrived within a week. I chose this one because it was about $140 and was listed in the Panasonic section of the WiKi. The default IP address on the camera is 192.168.0.253 (in case you hate reading manuals). I configured it to use DHCP and WiFi, allowing me to connect it anywhere my access point provides a decent signal.

Setting it up in ZoneMinder was simple. I defined it as an external source in motion-record mode. Setting up the URL of the camera was simple, following the documentation on sources.

I'm planning on adding a ClearCam II in the coming days via a video capture card. I haven't decided what card yet, but will post with results. The camera, receiver, and capture card shouldn't cost more than $140, and should provide even better quality. A great source for ZoneMinder compatible cameras and capture cards is Bluecherry.net. At your request, they also ship a live Linux CD with ZoneMinder installed with any order at not cose. This lets you try ZoneMinder without worrying about installing it, or knowing anything about Linux, for that matter. I also found this CD available for download on sourceforge.net.

As my setup becomes more elaborate, I'll post any issues I come across. If past experience is an indicator, I don't expect to be posting any time soon. HTH,

@@ron

Sources:
ZoneMinder UVC HowTo
An older ZoneMinder/Ubuntu HowTo

No comments: