MythZoneMinder

From MythTV Official Wiki
Revision as of 17:00, 28 November 2006 by Paulh (Talk | contribs)

Jump to: navigation, search

MythZoneMinder

MythZoneMinder is a plugin to interface to some of the features of ZoneMinder. You can use it to view a status window similar to the console window in ZM. Also there are screens to view live camera shots and replay recorded events. Other features may be added at a later time if there is sufficient interest.

Limitations of the Current Version

  • Requires a small change to the ZoneMinder source code for the Live View to work.
  • ZoneMinder must be running on the same machine as you are running the frontend.
  • The plugin uses OpenGL to render the video frames so you must have a working OpenGL setup.
  • The utilities provided by ZM are currently designed to be run by the web server user so in order for the plugin to use them requires configuring sudo to allow the mythtv user to run them as the apache user. More details on how to do that below.

Dependencies

You must already have a working ZoneMinder installation. The plugin has been tested with version 1.22.2 but 1.22.3 may also work but is untested. Currently ZM must be on the same machine that is running the frontend.

The current version of ZM requires a simple one line change to allow the plugin read access to its shared memory. The ZM author is aware of the limitation and future versions of ZM will allow the permissions on its shared memory to be set via a config setting.

All you need to do is change line 243 of zm_monitor.cpp from

   shm_id = shmget( (config.shm_key&0xffffff00)|id, shm_size, IPC_CREAT|0700 );

to

   shm_id = shmget( (config.shm_key&0xffffff00)|id, shm_size, IPC_CREAT|0755 );

and recompile and install ZM. If you don't want to do that and would like to test the plugin you could run mythfrontend as root which will allow it to read ZM's shared memory.


Install MythZoneMinder

The plugin doesn't require any additional dependencies to compile. As with all the plugins you should have compiled and installed MythTV before trying to compile it.

PLEASE NOTE: This plugin requires MythTV svn rxxxx or later from trunk and will NOT work with the fixes branch.

The source code is part of the mythplugins repository and all that is needed to install it is to grab the latest mythplugins source from svn trunk and run configure with

 --enable-zoneminder 

added as a parameter when running the configure script Then compile and install the plugins in the normal way.

Setting up sudo

The current version of ZM is setup to only allow the web server user (apache) to run the utilities provided by it. It is possible for other users to run them but they usually fail with permissions problems or return invalid results.

The plugin uses one of these utilities (zmdc.pl) to get the status for the main daemon and the monitors. In order to get this to work properly requires setting up sudo to allow the mythtv user to run zmdc.pl as the apache user.

Use visudo to add this line at the bottom of /etc/sudoers

 mythtv aopen = (apache) NOPASSWD: /usr/bin/zmdc.pl

where :-

  • mythtv - is the user that runs the frontend
  • aopen - is the host name of the frontend
  • apache - is the user that runs the apache server
  • /usr/bin/zmdc.pl - is the full path to the zmdc.pl utility installed by ZM

The ZM author is aware of this and it is hoped that the next version of ZM will allow the user and group that ZM uses to be configurable to allow us to add the mythtv user to the ZM user group.

Running The plugin

The first thing you should do is go to MythZoneMinder's settings page and make sure the settings there are correct for your system. Currently the only setting is to set where ZomeMinder keeps its zm.conf configuration file (usually /etc). All the other settings required are read from this config file.

The various screens are described below

The Console Screen

Zm-console.jpg

The console screen shows you if the main ZM daemon is running, the current date/time, what the cpu load is and what percentage of the drive used to store events has been used. Below that is a list of monitors/cameras, their current status and a count of how many events are stored for each monitor.

Keys:-

  • UP/DOWN - moves the selected item in the list up down.
  • ESCAPE - exit back to the menu.

The Live View Screen

The live screen shows live views from any available monitor. Currently there are views to show 1, 2 or 4 monitors simultaneously. Above each monitor view is the camera name and the current status eg idle, alert or alarm.

Keys:-

  • INFO - switches from 1,2 or 4 camera views.
  • 1 - cycles though each available monitor to be shown on the first view
  • 2,3,4 - ditto for the second, third, and forth views if the current screen layout has one
  • ESCAPE - return to the menu.

The Events Screen

Zm-events.jpg

The event screen shows a list of all stored events. You can filter the list to show events from just one monitor or all monitors. Events can be played of deleted as required.

Keys:-

  • UP/DOWN - Move focus to the next/previous widget. When the camera list has focus they change the selected item in the list.
  • LEFT/RIGHT - Move focus to the next/previous widget. When the camera 'selector' widget has focus they change the selected item.
  • ESCAPE - return to the menu

The Event Player Screen

The event screen plays recorded events.

  • UP/DOWN - Move focus to the next/previous widget.
  • LEFT/RIGHT - When paused moves the the previous/next frame in the event.
  • PAGEUP/ - Move to the previous/next event.
  • PAGEDOWN
  • PAUSE - Toggles play pause on/off
  • DELETE - Delete the current event and move to the next one in the list
  • SWITCHASPECT - toggle full screen mode on/off
  • ESCAPE - return to the events list screen.


TODO

Allow ZM to be running on a machine other that the frontend machine. This will have to wait for me to eventally get a dedicated BE machine setup in the loft.