Mind Your Zone Business

Bon Voyeurism: It’s a one-way trip

[EDIT] This guide has been update for Ubuntu 14.04 LTS Server. If you are running older servers, then you should really upgrade, as this guide will not work.

Sighmon Butterfield owns a coffee shop. But, his employees have been stealing from him. To possibly prevent future sighable situations, he called us in to set up a security camera system.

Using spare computer parts and 100% open source software, we were able to set up a pretty decent security cam system for close to $0.

Materials:
– Computer with Ubuntu installed (and LAMP)
– Logitech Communicate STX camera***
ZoneMinder software

Procedure:

1. Give the computer a static IP if possible

2. Install ZoneMinder (via command line for true-tested results):

 
sudo apt-get install zoneminder
sudo ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf 
sudo adduser www-data video
sudo a2enmod cgi

– If you’re lucky, zoneminder will install the dependencies including mysql-server. You will be prompted by a colored screen, and you will have to choose a password for your mysql server.  Remember your password!
– If you’re really lucky, then you zoneminder will be finished and all you have to do is open your web browser and go to:
http://localhost/zm

3. Setup your Camera(s) in the Console: http://localhost/zm

– check to see that your camera is recognized by the system with the command line:

lsusb

You should see your camera listed. Then see what video device it is assigned too:

ls /dev/video*

Likely it will be video0.

– Add a monitor by clicking “add new monitor” (you can give it a name on the first page)
– Click on “source” tab and set up your camera details.  The following settings work with most supported cameras:
Device Path: /dev/video0 <– be sure to add the “0” or “1” etc at the end.
Capture Method: Video For Linux version 2
Device Channel: 0 <– this will be 0 for every device that you plug in…[EDIT](Try 0 fist; some devices might be different — see comments)
Device Format: PAL <– even in North America this seems to work
Capture Palette: YUYV
Capture Width: 320
Caputre Height: 240

Note: 320×240 is one of the keys to making a lot of cameras work regardless of the other settings. You’ll know that your camera is working if the /dev/video0 link turns yellow/orange (by default it is in monitor mode; it will be green in modect mode)

So, assuming that you have them all working.  You can now click on the Name of your monitor from the console and see what it sees in the window that pops up. If you have more than one camera you can view a montage by clicking “montage” near the top right of the console.

4. Unlucky Troubleshooting:

(a) If your camera seems to work, but you cannot view the image in your browser, then is because apache2 has cgi disabled. Enable it with:

sudo a2enmod cgi

(b) If you have a picky camera like our Logitech Communicate STX camera, then you will have to do the following tweak (source) in order to get it to stay yellow/green/etc and display a picture:

gksudo gedit /usr/bin/zmdc.pl

and add this code, right before the “my @daemons =….” (about line 64).

$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l1compat.so';

Finally the ZoneMinder Settings for the Logitech Communicate STX

Device Path: /dev/video0 <- or whatever device number it is
Capture Method: Video For Linux version 2
Device Channel: 0
Device Format: NTSC
Capture Palette: RGB24
Capture Width: 320
Caputre Height: 240

(c) Help! I switched to the “mobile” skin, and I can’t access the options anymore.

Go to:

http://localhost/zm/index.php?skin=classic

Then visit your options –> display, and save “classic” as your display choice.

That should get you up and running, and ready for the more advanced features of ZoneMinder (Tutorials coming soon). If you are in the Vancouver, BC area, then we may be doing a live demo of this tutorial and others in the Ubuntu Vancouver LoCo

Until then, keep minding your Zone!

6 thoughts on “Mind Your Zone Business

  1. Pingback: The WoL, the WoW, and the WoT! | Sigh Hacker

  2. Pingback: DIY Time Zone | Sigh Hacker

  3. Attention!

    I was poking around with this for a whole night with the Quickcam STX (046d:08d7)
    and a Zoneminder Virtual appliance (http://blog.waldrondigital.com/2012/09/23/zoneminder-virtual-machine-appliance-for-vmware-esxi-workstation-fusion/)

    It would not work at all, i only got green or black images with digital noise on it. The Zoneminder log was also full of errors like ‘zmc -d /dev/video0’ exited abnormally, exit status 255

    I found out, that on newer Ubuntu versions (the virtual appliance uses 12.04), the v4l1compat.so file is at /usr/lib/i386-linux-gnu/libv4l/ instead of the path mentioned at step 5.

    I now got a image sometimes, but it is still very buggy

  4. “Device Channel: 0 <– this will be 0 for every device that you plug in…"
    Not always, I use an old tv card with a cctv camera plugged into the yellow connector and so I have to use "Device Channel: 1". My guess is that it is also true for multi-input cards.
    Also might check out v4l2-ctl for some devices.
    sudo v4l2-ctl -d /dev/video0 –list-formats
    sudo v4l2-ctl -d /dev/video0 –list-framesizes=YUYV
    sudo v4l2-ctl -d /dev/video0 –list-framesizes=MJPG
    and many more

Leave a Reply

Your email address will not be published. Required fields are marked *