ZoneMinder CCTV Camera Monitoring Software
ZoneMinder is a set of applications intended for use in CCTV video camera security applications. It supports capture, analyse, recording and monitoring of any cameras you have attached to a Linux based machine. It also features a user-friendly Web interface which allows viewing, archival, review, and deletion of images and movies captured by the cameras.
ZoneMinder has a highly configuratble image analysis system permitting retention of specific events, while eliminating false positives. ZoneMinder supports both directly connected and network cameras and is built around the definition of a set of individual 'zones' of varying sensitivity and functionality for each camera.
This allows the elimination of regions which should be ignored or the definition of areas which will alarm if various thresholds are exceeded in conjunction with other zones. All management, control, and other functions are supported through the Web interface.
ZoneMinder is designed to run on kernels which support the Video For Linux (V4L) interface and has been tested with cameras attached to BTTV cards, various USB cameras and IP network cameras. It is designed to support as many cameras as you can attach to your computer without too much degradation of performance.
Contents
ZoneMinder Web Site
Fedora Information for package zoneminder
ZoneMinder Tutorial
Fedora Setup
- Have packages for Apache and MySQL installed on the sytem.
- Install the zoneminder RPM package on the system
- Configure zoneminder
The packaged version of Zone Minder installs all binarys to /usr/lib/zm including the web pages. So don’t worry when you do not see any files installed to the root directory for your web server. The web pages for Apache are aliased by zm.conf in the apache/conf.d directory which vary depending on your distribution.
- Make sure Apache and MySQL services are running
- Edit the zoneminder.conf apache configuration file to allow web connections
vi /etc/httpd/conf.d/zoneminder.conf
- Build the MySQL database table for zoneminder
mysql -p -u root mysql < /usr/share/zoneminder/db/zm_create.sql > mysqladmin -p -u root reload
locations and paths
The Fedora RPM creates /var/log/zoneminder, but the database scripts point logs to /tmp, rather than the new directory. (Stupid)
- Click Options, Paths tab, and change
ZM_PATH_LOGS = /var/log/zoneminder
- Click Options, Debug tab, and change
ZM_EXTRA_DEBUG_LOG = /var/log/zoneminder/zm_debug.log+
Find the php program files:
cd /usr/share/zoneminder/www/
Find the jpg still captures:
cd /var/lib/zoneminder/events
Available sounds:
cd /usr/share/zoneminder/www/sounds
Others:
- /etc/zm.conf : file is generated by 'configure'
- /usr/share/zoneminder/www/zm_config.php : web configuration file
ffmpeg: converts jpg captured frames into mpeg video
NOTE: Unable to get ZM_STREAM_METHOD mpeg or mpeg export working due to flaw in RPM build and ffmpeg version. No solution is currently available. A work around is to run ffmpeg from the command shell to turn still JPEG images into MPEG video if you install ffmpeg per instructions below.
- Install ffmpeg on Fedora.
Due to licensing the ffmpeg package is absent from Fedora. It can be added from Livna.
wget http://rpm.livna.org/livna-release-8.rpm rpm -ih livna-release-8.rpm yum install ffmpeg yum install ffmpeg-devel
Which provides the following: ffmpeg-libs-0.4.9-0.41.20071011.lvn8, ffmpeg-0.4.9-0.41.20071011.lvn8, ffmpeg-devel-0.4.9-0.41.20071011.lvn8
- Test ffmpeg
ffmpeg -f image2 -i %03d-capture.jpg /tmp/movie.mpg
- Configuration changes in zoneminder necessary
- Goto the Options menu, click on the Images tab
- Change the following options for Fedora:
- ZM_PATH_MPEG_ENCODE: /usr/bin/mpeg_encode
- ZM_PATH_FFMPEG: /usr/bin/ffmpeg
Monitor Functions
- None – The monitor is currently disabled and no streams can be viewed or events generated.
- Monitor – The monitor will only stream feeds but no image analysis is done and so no alarms or events will be generated,
- Modect – or MOtion DEteCTtion. All captured images will be analysed and events generated where motion is detected.
- Record – In this case continuous events of a fixed length are generated regardless of motion which is analogous to a convention time-lapse video recorder. No motion detection takes place in this mode.
- Mocord – This is a hybrid of Modect and Record and results in both fixed length events being recorded and also any motion being highlighted within those events.
- Nodect – or No DEteCTtion. This is a special mode designed to be used with external triggers. In Nodect no motion detection takes place but events are recorded if external triggers require it.
Capture Width x Height
The Analog TV and Digital Video Resolution Guide explains how lines of TV resolution translates into pixels. The default setting for a camera on ZoneMinder is 320x240 pixels.
First, your capture card can limit the resolution you must use. The capabilities of the capture card may dictate that you set 320x240 for all your cameras connected to the capture card - if using an analog capture card.
For IP cameras the best match between camera and pixel resolution is if the number of lines equals with the height of the captured picture.
- For resolutions above 352x240 NTSC the video will become interlaced.
- For resolutions above 368x288 PAL the video will become interlaced.
When an image is interlaced, basically 2 passes are made on camera, one pass for odd lines, one for even, and these are spliced together to form one image. The interlaced frames are 1/60th of a second apart.
de-interlacing errors on 878A single chip cards
ZM_CAPTURES_PER_FRAME with interlacing, the default is 3, you can try 2 to solve interlacing problems. If you stick with 320x240 you will not have to worry about interlacing issues.
Quality
I recommend setting quality to '85'
85 ZM_JPEG_FILE_QUALITY Set the JPEG quality setting for the saved event files (1-100) (?) 85 ZM_JPEG_IMAGE_QUALITY Set the JPEG quality setting for the streamed 'live' images (1-100) (?)
Advanced
zoneminder is made up of 3 types of programming
- C++ compiled binaries
- /usr/bin/zm*
- /usr/libexec/zoneminder/cgi-bin/zms
- /usr/libexec/zoneminder/cgi-bin/nph-zms
- perl scripts
- /usr/bin/zm*.pl
- php scripts
- /usr/share/zoneminder/www/zm_*.php
zmu -d /dev/video0 -q show device settings zmu -m 8 -q show settings for monitor with id "8" zmu -m 8 -s state for monitor 8, 0 = idle, 1 = prealarm, 2 = alarm, 3 = alert, 4 = tape
Inded of documented zmu commands: http://www.zoneminder.com/wiki/index.php/Zmu
zoneminder components including C++, Perl, and PHP