Difference between revisions of "MythZoneMinder"

From MythTV Official Wiki
Jump to: navigation, search
m (Add some image captions)
m (Troubleshooting: Replaced ; with : to alter formatting.)
 
(31 intermediate revisions by 10 users not shown)
Line 1: Line 1:
=MythZoneMinder=
+
==MythZoneMinder==
  
MythZoneMinder is a plugin to interface to some of the features of [http://www.zoneminder.com/index.html ZoneMinder]. You can use it to view a status window similar to  
+
MythZoneMinder is a plugin to interface to some of the features of [http://www.zoneminder.com 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
+
the console window in ZM where you can check the ZM servers status as well as enable/disable a camera, turn on notifications and alter the camera recording function (i.e. record only on motion detection etc). There are screens to view live camera shots showing 1, 2, 4, 6 or 8 cameras and replay recorded events which can be filtered by camera and date. There is also a notification pop-up that can be turned on for each camera that pops up a mini view of a camera whenever motion has been detected. Other features may be added at a later time if there is sufficient interest.
replay recorded events. Other features may be added at a later time if there is
+
*'''ZoneMinder''' is a Linux video camera security and surveillance solution
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==
 
==Dependencies==
  
You must already have a working ZoneMinder installation. The plugin has been  
+
You must already have a working ZoneMinder installation accessible somewhere on your network. The plugin has been
tested with version 1.22.2 but 1.22.3 may also work but is untested. Currently ZM must
+
tested with versions from 1.22.2 up to 1.30.0
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.
 
  
  
Line 35: Line 15:
 
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.
 
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 git and run configure with  
 
 
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  
 
   --enable-zoneminder  
added as a parameter when running the configure script Then compile and install the plugins in the normal way.
+
added as a parameter when running the configure script.
 
 
==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
+
Then compile and install the plugins in the normal way.
  
  mythtv aopen = (apache) NOPASSWD: /usr/bin/zmdc.pl
+
==Install MythZMServer==
  
where :-
+
mythzmserver is a small daemon that should be run on same machine that ZoneMinder is running on. It is a server that responds to request for information like ZMs server status, live frame data, event frames etc from mythfrontends running the MythZoneMinder plugin.
  
*mythtv          - is the user that runs the frontend
+
===Compiling MythZMServer===
*aopen            - is the host name of the frontend
+
The server will be compiled as part of the normal mythplugins compilation and if the server machine is running similar versions of the required libraries then you can simply copy the mythzmserver executable over to the server machine.
*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  
+
If not then you should copy the mythzmserver directory over to the server machine and compile the source there. It doesn't require Myth or QT to be installed. You can use the Makefile.standalone to do the compilation like this:-
user and group that ZM uses to be configurable to allow us to add the mythtv user to the ZM user group.
+
make -f Makefile.standalone
 +
then simply copy the resulting mythzmserver to a suitable location.
  
 +
===Running MythZMServer===
 +
You should usually start mythzmserver as a service at boot time. It must be started after the ZoneMinder server has been started. One way to do this is to modify the ZM startup script to also start/stop mythzmserver. The server should be run as either root or as the same user that ZM uses. By default the server will listen on port 6548 and will read the ZM config from /etc/zm.conf if you need to change any of these you can add a parameter to change them. See the README in the mythzmserver source directory for a list of available parameters.
 +
 
 
==Running The plugin==
 
==Running The plugin==
  
 
The first thing you should do is go to MythZoneMinder's settings page and make sure
 
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
+
the settings there are correct for your system. Currently the only settings are for the IP address and port that the plugin should use to connect to the mythzmserver.
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 various screens are described below==
Line 73: Line 44:
 
====The Console Screen====
 
====The Console Screen====
 
[[Image: Zm-console.jpg|thumb|The Console Screen]]
 
[[Image: Zm-console.jpg|thumb|The Console Screen]]
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.
+
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:-
 
Keys:-
Line 82: Line 53:
 
====The Live View Screen====
 
====The Live View Screen====
 
[[Image: Zm-liveplayer1.jpg|thumb|Live View - 1 camera]][[Image: Zm-liveplayer2.jpg|thumb|Live View - 2 cameras]][[Image: Zm-liveplayer4.jpg|thumb|Live View - 4 camera]]
 
[[Image: Zm-liveplayer1.jpg|thumb|Live View - 1 camera]][[Image: Zm-liveplayer2.jpg|thumb|Live View - 2 cameras]][[Image: Zm-liveplayer4.jpg|thumb|Live View - 4 camera]]
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
+
The live screen shows live views from any available monitor. Currently there are views to show 1, 2, 4, 6 or 8 cameras/monitors simultaneously. Above each monitor view is the
camera name and the current status eg idle, alert or alarm.
+
camera name and the current status e.g. idle, alert or alarm.
  
 
Keys:-
 
Keys:-
Line 92: Line 63:
  
 
====The Events Screen====
 
====The Events Screen====
[[Image: Zm-events.jpg|thumb|Events Screen]]
+
[[Image: Zm-events.jpg|thumb|Events Screen - List View]]
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.
+
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 and also by date. Events can be played of deleted as required.
 +
[[Image: Zm-eventsgrid.jpg|thumb|Events Screen - Grid View]]
 +
The grid view shows the events list in an image grid with each image being an analysis image showing any movement detected outlined in red. You can switch the grid view to show 1, 2 or 6 images in the grid by pressing the 1,2 or 6 number keys. 
 +
 
  
 
Keys:-
 
Keys:-
  
*UP/DOWN      - Move focus to the next/previous widget. When the camera list has focus they change the selected item in the list.
+
*UP/DOWN      - In the camera and date 'selector' widget change the selected item.
*LEFT/RIGHT  - Move focus to the next/previous widget. When the camera 'selector' widget has focus they change the selected item.
+
*LEFT/RIGHT  - Move focus to the next/previous widget.  
*ESCAPE      - return to the menu
+
*SELECT      - Plays the event if the list or grid has focus or activates all other widgets. 
 
+
*MENU        - Show a popup menu with options to refresh the events list, switch views and delete all events that match the current filter.
 +
*DELETE      - Delete the currently selected event.
 +
*INFO        - Toggles the event list order. It will remember your chose and use it the next time the event list screen is shown.
 +
*ESCAPE      - When the grid has focus move the focus to the next widget elsewhere returns to the menu
 +
*1,2,6        - Switch the grid view to show 1, 2 or 6 images in the grid.
 +
*0            - Toggle the view between the list view or grid view.
 +
 
====The Event Player Screen====
 
====The Event Player Screen====
 
[[Image: Zm-player.jpg|thumb|Event Player Screen]]
 
[[Image: Zm-player.jpg|thumb|Event Player Screen]]
Line 112: Line 92:
 
*SWITCHASPECT - toggle full screen mode on/off
 
*SWITCHASPECT - toggle full screen mode on/off
 
*ESCAPE      - return to the events list screen.
 
*ESCAPE      - return to the events list screen.
 +
 +
==Troubleshooting==
 +
 +
How to overcome some common issues:
 +
 +
:1. mythzmserver fails to start with a "This version of ZM is to old you need 1.24.0 or later" error message.
 +
:- Newer versions of ZoneMinder no longer put the ZM_VERSION in the zm.conf configuration file which mythzmserver uses to configure itself.
 +
Simply add the line '''ZM_VERSION=1.30.0''' to the config file which you can find at /etc/zm.conf or sometimes /etc/zm/zm.conf.
 +
 +
:2. MythFrontend crashes after you try to enter the live view screen.--[[User:Tgutwin|Tgutwin]] 21:39, 4 March 2007 (UTC)
 +
:- If you have just changed any of your ZM monitor sources (/dev/video0 to /dev/video3 for example) you will need to restart the mythzmserver. Find the mythzmserver process, kill it, and restart it.
 +
:- Try turning off OpenGL playback in the settings panel as this can cause the X server to crash.
 +
{{Outdated2|The following may be outdated and not relevant for current MythTV/ZoneMinder installations}}
 +
:3. Mythtv can't find the zm installation.  Error messages show up in the myth logs(or console) when you try to access the MythZoneMinder menu items.--[[User:Tgutwin|Tgutwin]] 21:39, 4 March 2007 (UTC)
 +
: This might happen if the MythTV install was not in /usr/local and when ZM was installed in /usr/local.  You need to add the ZM_PATH_BIN variable into the /etc/zm.conf
 +
  Here is an example /etc/zm.conf file:
 +
      #ZM_DB_HOST=10.0.0.212
 +
      ZM_VERSION=1.22.3
 +
      ZM_DB_NAME=zm
 +
      ZM_DB_USER=whateverYourZMDBUsernameIs
 +
      ZM_DB_PASS=******
 +
      ZM_PATH_WEB=/var/media/security/zoneMinderWWW
 +
      ZM_PATH_BIN=/usr/local/bin
 +
      #ZM_WEB_USER
 +
{{Outdated2|The following may be outdated and not relevant for current MythTV/ZoneMinder installations}}
 +
:4. ZoneMinder Plugin UI Menus and objects not installing with make install. (when building from svn source)--[[User:Tgutwin|Tgutwin]] 21:39, 4 March 2007 (UTC)
 +
:If many of the additional MythTV plugins, including MytZoneMinder, are giving an error dialog in MythTV when entering the plugin menus such as: "Could not locate 'status_text' in theme 'X' " . It is probably because the Plugin UI Menus and objects not installing with make install.  I had trouble with the plugins call to 'sudo make install' not working correctly.  You might need to call the individual install targets explicitly as follows:
 +
    [root[at]dvr mythplugins]$ cd mythzoneminder/mythzoneminder
 +
    [root[at]dvr mythzoneminder]$ make install_target install_menufiles install_uifiles install_installimages
 +
    [root[at]dvr mythzoneminder]$ cd ../../mythnews/mythnews
 +
    [root[at]dvr mythnews]$ make install_target install_uifiles install_installimages
 +
    [root[at]dvr mythnews]$ cd ../../mythgallery/mythgallery
 +
    [root[at]dvr mythgallery]$ make install_target install_installimages install_uifiles
 +
    [root[at]dvr mythgallery]$ cd ../../mythmusic/mythmusic
 +
    [root[at]dvr mythmusic]$ make install_target install_installfiles install_uifiles
 +
    [root[at]dvr mythmusic]$ cd ../../mythweather/mythweather
 +
    [root[at]dvr mythweather]$ make install_target install_installfiles install_installimages install_uifiles
 +
    [root[at]dvr mythweather]$ cd ../..
  
 
==TODO==
 
==TODO==
 
+
Remove the need for mythzmserver and use the new ZoneMinder API to access the ZM server directly.  
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.
 
  
 
[[Category:Plugins]]
 
[[Category:Plugins]]

Latest revision as of 08:15, 7 March 2021

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 where you can check the ZM servers status as well as enable/disable a camera, turn on notifications and alter the camera recording function (i.e. record only on motion detection etc). There are screens to view live camera shots showing 1, 2, 4, 6 or 8 cameras and replay recorded events which can be filtered by camera and date. There is also a notification pop-up that can be turned on for each camera that pops up a mini view of a camera whenever motion has been detected. Other features may be added at a later time if there is sufficient interest.

  • ZoneMinder is a Linux video camera security and surveillance solution

Dependencies

You must already have a working ZoneMinder installation accessible somewhere on your network. The plugin has been tested with versions from 1.22.2 up to 1.30.0


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.

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 git 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.

Install MythZMServer

mythzmserver is a small daemon that should be run on same machine that ZoneMinder is running on. It is a server that responds to request for information like ZMs server status, live frame data, event frames etc from mythfrontends running the MythZoneMinder plugin.

Compiling MythZMServer

The server will be compiled as part of the normal mythplugins compilation and if the server machine is running similar versions of the required libraries then you can simply copy the mythzmserver executable over to the server machine.

If not then you should copy the mythzmserver directory over to the server machine and compile the source there. It doesn't require Myth or QT to be installed. You can use the Makefile.standalone to do the compilation like this:-

make -f Makefile.standalone

then simply copy the resulting mythzmserver to a suitable location.

Running MythZMServer

You should usually start mythzmserver as a service at boot time. It must be started after the ZoneMinder server has been started. One way to do this is to modify the ZM startup script to also start/stop mythzmserver. The server should be run as either root or as the same user that ZM uses. By default the server will listen on port 6548 and will read the ZM config from /etc/zm.conf if you need to change any of these you can add a parameter to change them. See the README in the mythzmserver source directory for a list of available parameters.

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 settings are for the IP address and port that the plugin should use to connect to the mythzmserver.

The various screens are described below

The Console Screen

The Console Screen

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

Live View - 1 camera
Live View - 2 cameras
Live View - 4 camera

The live screen shows live views from any available monitor. Currently there are views to show 1, 2, 4, 6 or 8 cameras/monitors simultaneously. Above each monitor view is the camera name and the current status e.g. 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

Events Screen - List View

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 and also by date. Events can be played of deleted as required.

Events Screen - Grid View

The grid view shows the events list in an image grid with each image being an analysis image showing any movement detected outlined in red. You can switch the grid view to show 1, 2 or 6 images in the grid by pressing the 1,2 or 6 number keys.


Keys:-

  • UP/DOWN - In the camera and date 'selector' widget change the selected item.
  • LEFT/RIGHT - Move focus to the next/previous widget.
  • SELECT - Plays the event if the list or grid has focus or activates all other widgets.
  • MENU - Show a popup menu with options to refresh the events list, switch views and delete all events that match the current filter.
  • DELETE - Delete the currently selected event.
  • INFO - Toggles the event list order. It will remember your chose and use it the next time the event list screen is shown.
  • ESCAPE - When the grid has focus move the focus to the next widget elsewhere returns to the menu
  • 1,2,6 - Switch the grid view to show 1, 2 or 6 images in the grid.
  • 0 - Toggle the view between the list view or grid view.

The Event Player Screen

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/PAGEDOWN - Move to the previous/next event.
  • 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.

Troubleshooting

How to overcome some common issues:

1. mythzmserver fails to start with a "This version of ZM is to old you need 1.24.0 or later" error message.
- Newer versions of ZoneMinder no longer put the ZM_VERSION in the zm.conf configuration file which mythzmserver uses to configure itself.

Simply add the line ZM_VERSION=1.30.0 to the config file which you can find at /etc/zm.conf or sometimes /etc/zm/zm.conf.

2. MythFrontend crashes after you try to enter the live view screen.--Tgutwin 21:39, 4 March 2007 (UTC)
- If you have just changed any of your ZM monitor sources (/dev/video0 to /dev/video3 for example) you will need to restart the mythzmserver. Find the mythzmserver process, kill it, and restart it.
- Try turning off OpenGL playback in the settings panel as this can cause the X server to crash.

Time.png Outdated: The following may be outdated and not relevant for current MythTV/ZoneMinder installations

3. Mythtv can't find the zm installation. Error messages show up in the myth logs(or console) when you try to access the MythZoneMinder menu items.--Tgutwin 21:39, 4 March 2007 (UTC)
This might happen if the MythTV install was not in /usr/local and when ZM was installed in /usr/local. You need to add the ZM_PATH_BIN variable into the /etc/zm.conf
  Here is an example /etc/zm.conf file: 
      #ZM_DB_HOST=10.0.0.212
      ZM_VERSION=1.22.3
      ZM_DB_NAME=zm
      ZM_DB_USER=whateverYourZMDBUsernameIs
      ZM_DB_PASS=******
      ZM_PATH_WEB=/var/media/security/zoneMinderWWW
      ZM_PATH_BIN=/usr/local/bin
      #ZM_WEB_USER

Time.png Outdated: The following may be outdated and not relevant for current MythTV/ZoneMinder installations

4. ZoneMinder Plugin UI Menus and objects not installing with make install. (when building from svn source)--Tgutwin 21:39, 4 March 2007 (UTC)
If many of the additional MythTV plugins, including MytZoneMinder, are giving an error dialog in MythTV when entering the plugin menus such as: "Could not locate 'status_text' in theme 'X' " . It is probably because the Plugin UI Menus and objects not installing with make install. I had trouble with the plugins call to 'sudo make install' not working correctly. You might need to call the individual install targets explicitly as follows:
   [root[at]dvr mythplugins]$ cd mythzoneminder/mythzoneminder
   [root[at]dvr mythzoneminder]$ make install_target install_menufiles install_uifiles install_installimages
   [root[at]dvr mythzoneminder]$ cd ../../mythnews/mythnews
   [root[at]dvr mythnews]$ make install_target install_uifiles install_installimages
   [root[at]dvr mythnews]$ cd ../../mythgallery/mythgallery
   [root[at]dvr mythgallery]$ make install_target install_installimages install_uifiles
   [root[at]dvr mythgallery]$ cd ../../mythmusic/mythmusic
   [root[at]dvr mythmusic]$ make install_target install_installfiles install_uifiles
   [root[at]dvr mythmusic]$ cd ../../mythweather/mythweather
   [root[at]dvr mythweather]$ make install_target install_installfiles install_installimages install_uifiles
   [root[at]dvr mythweather]$ cd ../..

TODO

Remove the need for mythzmserver and use the new ZoneMinder API to access the ZM server directly.