Running Zoneminder and Motion together
-
- Posts: 12
- Joined: Mon Dec 31, 2007 5:27 pm
Running Zoneminder and Motion together
Hi
After a huge deluge (where deluge = 1) of people asking me how to run Zoneminder and Motion together I have written this guide. It may answers some questions that people have and I would be interested in other peoples experiences. All I can say is that it works for me on my setup and actually doesn't take long to install Motion so its worth a go.
Respects to the authors of Zoneminder and Motion for writing truly excellent software.
Regards
Sledgehammer
Running Zoneminder and Motion together
This document was written as an aide memoir for myself and for others that may find it useful. It summarizes what needs to be done to enable the use of Zoneminder as the overall manager of a CCTV system but using Motion to do the motion detection. The websites for the software in question are at:
http://www.zoneminder.com/
http://www.lavrsen.dk/twiki/bin/view/Motion/
Lets Start
This is the setup I use, others may work.
1)Zoneminder 1.22.3
2)Kernel 2.6.20 no later at the time of writing (V4l2 issues ?)
3)Motion V3.2.10.1
4)Kodicom 4400R/ BT878 setup. Others should work, your mileage may vary!
5)I use Gentoo so the command line specifics and file locations may be different for you
It is assumed that you have Zoneminder up and running to your liking as there are plenty of good installation instructions around. If you are installing from scratch then do follow those instructions but don't get bogged down in the detail of motion detection zones as you won't be using them. I guess thats why you're reading this any way Just use the default zone for each camera and ensure that motion detection will record normally and just the way you like it, ie resolution, frames per second, duration etc.
The modifications you need for Zoneminder are;
1)Check ZM_OPT_TRIGGERS in the system tab of the options page as we will be using the zmtrigger.pl script and this setting needs to be checked.
2)My ZM_OPT_FRAME_SERVER is unchecked (save cpu cycles?)
3)Set your cameras Function to Nodect as we will be using Motion to do the motion detection
4)I found the zmtrigger.pl script crashed when run so I commented out the following lines. You will need the line containing “Chan1â€
After a huge deluge (where deluge = 1) of people asking me how to run Zoneminder and Motion together I have written this guide. It may answers some questions that people have and I would be interested in other peoples experiences. All I can say is that it works for me on my setup and actually doesn't take long to install Motion so its worth a go.
Respects to the authors of Zoneminder and Motion for writing truly excellent software.
Regards
Sledgehammer
Running Zoneminder and Motion together
This document was written as an aide memoir for myself and for others that may find it useful. It summarizes what needs to be done to enable the use of Zoneminder as the overall manager of a CCTV system but using Motion to do the motion detection. The websites for the software in question are at:
http://www.zoneminder.com/
http://www.lavrsen.dk/twiki/bin/view/Motion/
Lets Start
This is the setup I use, others may work.
1)Zoneminder 1.22.3
2)Kernel 2.6.20 no later at the time of writing (V4l2 issues ?)
3)Motion V3.2.10.1
4)Kodicom 4400R/ BT878 setup. Others should work, your mileage may vary!
5)I use Gentoo so the command line specifics and file locations may be different for you
It is assumed that you have Zoneminder up and running to your liking as there are plenty of good installation instructions around. If you are installing from scratch then do follow those instructions but don't get bogged down in the detail of motion detection zones as you won't be using them. I guess thats why you're reading this any way Just use the default zone for each camera and ensure that motion detection will record normally and just the way you like it, ie resolution, frames per second, duration etc.
The modifications you need for Zoneminder are;
1)Check ZM_OPT_TRIGGERS in the system tab of the options page as we will be using the zmtrigger.pl script and this setting needs to be checked.
2)My ZM_OPT_FRAME_SERVER is unchecked (save cpu cycles?)
3)Set your cameras Function to Nodect as we will be using Motion to do the motion detection
4)I found the zmtrigger.pl script crashed when run so I commented out the following lines. You will need the line containing “Chan1â€
-
- Posts: 5111
- Joined: Wed Jun 08, 2005 8:07 pm
- Location: Midlands UK
great post thanks
James Wilson
Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
-
- Posts: 6
- Joined: Tue May 20, 2008 10:30 am
- Location: Poland
-
- Posts: 12
- Joined: Mon Dec 31, 2007 5:27 pm
I'm not sure what you mean really but if you are talking about the motion detection algorithm then I'm guessing Motions is faster than ZM because, at least in my case, the average system load went down.SyRenity wrote:Hi.
How fast motion compared to ZM?
Regards.
mateuszknapik, Glad you got it all working. How are the number of false alarms holding up? There always seems to be a special case that disproves any claims I make, usually five minutes after I post! Also pleased to hear it working with IP cameras.
Sledgehammer
-
- Posts: 4
- Joined: Mon Oct 13, 2008 6:45 pm
Re: Running Zoneminder and Motion together
See the first post.sledgehammer wrote: Install Motion
Install Motion by any means you have. The configuration is going to be easy as we will not be using most options. We will do a basic one camera configuration.
Edit the motion.conf file in /etc. Leave most settings at their defaults and modify only the following lines. This file is very well commented so don't worry.
...SNIP...
http://www.lavrsen.dk/twiki/bin/view/Motion/
-
- Posts: 4
- Joined: Mon Oct 13, 2008 6:45 pm
Hi
I went back and read the original post.
Also I read the motion how-to's and searched google for my problem.
However the problem persists.
I'll clarify:
I have a grandtec 4 port capture board (single chip).
In /dev/ I have only video0 (no video1, video2....)
I have zoneminder working. All 4 cameras work very nice.
In motion, I started out with only motion.conf. That got me a videostream on port 8080 where all cameras were streaming in the same "window", kind of cycling trough all of them. Looked nasty.
Then I created the threadN.conf files where videodevice is /dev/video0 and input is 0-4.
Also webcam_port is different for each thread (8080-8083)
I deleted videodevice, input and wecam_port from monitor.conf.
I get a visible stream on all webcam_port's but they all show input 0-3.
So obiously I have missed something.
Since I only have /dev/video0, the only thing I can see that would select channels is input 0-3 but that doesn't seem to work.
I am certain that I've missed the obious. Please help.
I went back and read the original post.
Also I read the motion how-to's and searched google for my problem.
However the problem persists.
I'll clarify:
I have a grandtec 4 port capture board (single chip).
In /dev/ I have only video0 (no video1, video2....)
I have zoneminder working. All 4 cameras work very nice.
In motion, I started out with only motion.conf. That got me a videostream on port 8080 where all cameras were streaming in the same "window", kind of cycling trough all of them. Looked nasty.
Then I created the threadN.conf files where videodevice is /dev/video0 and input is 0-4.
Also webcam_port is different for each thread (8080-8083)
I deleted videodevice, input and wecam_port from monitor.conf.
I get a visible stream on all webcam_port's but they all show input 0-3.
So obiously I have missed something.
Since I only have /dev/video0, the only thing I can see that would select channels is input 0-3 but that doesn't seem to work.
I am certain that I've missed the obious. Please help.
You have to create a different config file for each additional camera you have, and point to that in the main motion.conf file. For example, you could call the additional files thread1.conf, thread2.conf and thread3.conf. Then you just add a reference to those files in motion.conf like so:
The format of the additional files is slightly different in that you don't need as many settings as for the main motion.conf one. Just specify a different input number on each of them. See http://www.lavrsen.dk/twiki/bin/view/Mo ... onfigFiles for more info.
Code: Select all
thread /etc/motion/thread1.conf
thread /etc/motion/thread2.conf
thread /etc/motion/thread3.conf
Sledgehammer,
Very interesting thread - for some reason I am intrigued to the point of wanting to give this a try... but I'm not sure why!
Whilst obviously respecting the hard work that has gone into both products, would you care to comment on the advantages (and disadvantages) on this dual approach?
I note you mentioned an overall drop in load... any other aspects of performance (ease of use, flexibility, false alarms etc) that stand out?
As a long-time ZM user I am very familiar with its operation but having never tried Motion can you think of anything, feature wise, that I might be 'missing' and would hence potentially benefit from by integrating as you have done?
Mathew
Very interesting thread - for some reason I am intrigued to the point of wanting to give this a try... but I'm not sure why!
Whilst obviously respecting the hard work that has gone into both products, would you care to comment on the advantages (and disadvantages) on this dual approach?
I note you mentioned an overall drop in load... any other aspects of performance (ease of use, flexibility, false alarms etc) that stand out?
As a long-time ZM user I am very familiar with its operation but having never tried Motion can you think of anything, feature wise, that I might be 'missing' and would hence potentially benefit from by integrating as you have done?
Mathew
Same here, I'd be interested in the answers too...MJN wrote:Sledgehammer,
Very interesting thread - for some reason I am intrigued to the point of wanting to give this a try... but I'm not sure why!
Whilst obviously respecting the hard work that has gone into both products, would you care to comment on the advantages (and disadvantages) on this dual approach?
I note you mentioned an overall drop in load... any other aspects of performance (ease of use, flexibility, false alarms etc) that stand out?
As a long-time ZM user I am very familiar with its operation but having never tried Motion can you think of anything, feature wise, that I might be 'missing' and would hence potentially benefit from by integrating as you have done?
Mathew
v1.25.0 + Ubuntu Linux 12.04 Server
-
- Posts: 12
- Joined: Mon Dec 31, 2007 5:27 pm
I've just looked at my first post and I see that I don't give any reasons for doing this so now I will.
Zoneminder has a complex motion detection scheme, Which when properly understood can give very good results. I ran all sorts of analysis on the stats from the cameras but was never able to get the number of false triggers down without affecting sensitivity to genuine motion. So I gave up, temporarily, and went to Motion. This give immediately better results almost with out of the box settings.
However Motion lacks certain "goodies" that Zoneminder provides and that is, in my opinion, a good web interface and streaming options. So I went back to Zoneminder only to get depressed again
However the idea of external triggers was interesting as I knew Motion could call scripts when motion was detected. So I played with it and was able to get Motion and Zoneminder to talk to each other. I was a little surprised to see the load go down but don't ask me for any quantifiable figures as I can't give any, its just my impression.
Of course using two systems like this means you can use Zoneminder detection on one camera and Motion on another, you have the choice ( I think thats a Linux thing?). Also the motion detection resolution can now be abstracted away from the motion capture. It may be that working at a low motion detection resolution works for you and of course this will reveal itself in a lower load.
There was another post, which I can't locate at the moment, discussing motion detection algorithms and some of the ideas mentioned were already present in Motion. This drove me to publish the Howto after some prodding.
I think if you are capable of installing Zoneminder then Motion will present no difficulties to you, except you do have to get down and dirty with config files. It is definitely worth a go and will not break (fingers crossed) your Zoneminder install so you have little to lose except a few hours playing and possibly a lot to gain.
Is my setup perfect? No far from it but what I would like is next to impossible. My front garden camera cannot cope with a low sun because cars going past create long shadows which of course is motion. The big tree in the wind with the sun, similar problem. And finally of course cloud shadows moving quickly. These are things that Motion doesn't do well but in my opinion still gives fewer false triggers than Zoneminder.
Hmm, I've just realised I could configure two cameras in Zoneminder from the same feed and use Motion to trigger one and Zoneminder to trigger the other and see if I can improve things. Well I could but probably won't as I am quite happy.
I've just had a look down through the previous posts and one other feature that springs to mind with Motion is the ability of 'live' tweaking of the detection parameters as described in the Howto.
Well all a bit of a ramble and probably not enough reasons or answers but if you are even slightly tempted do give it a go.
Regards
Sledgehammer
Zoneminder has a complex motion detection scheme, Which when properly understood can give very good results. I ran all sorts of analysis on the stats from the cameras but was never able to get the number of false triggers down without affecting sensitivity to genuine motion. So I gave up, temporarily, and went to Motion. This give immediately better results almost with out of the box settings.
However Motion lacks certain "goodies" that Zoneminder provides and that is, in my opinion, a good web interface and streaming options. So I went back to Zoneminder only to get depressed again
However the idea of external triggers was interesting as I knew Motion could call scripts when motion was detected. So I played with it and was able to get Motion and Zoneminder to talk to each other. I was a little surprised to see the load go down but don't ask me for any quantifiable figures as I can't give any, its just my impression.
Of course using two systems like this means you can use Zoneminder detection on one camera and Motion on another, you have the choice ( I think thats a Linux thing?). Also the motion detection resolution can now be abstracted away from the motion capture. It may be that working at a low motion detection resolution works for you and of course this will reveal itself in a lower load.
There was another post, which I can't locate at the moment, discussing motion detection algorithms and some of the ideas mentioned were already present in Motion. This drove me to publish the Howto after some prodding.
I think if you are capable of installing Zoneminder then Motion will present no difficulties to you, except you do have to get down and dirty with config files. It is definitely worth a go and will not break (fingers crossed) your Zoneminder install so you have little to lose except a few hours playing and possibly a lot to gain.
Is my setup perfect? No far from it but what I would like is next to impossible. My front garden camera cannot cope with a low sun because cars going past create long shadows which of course is motion. The big tree in the wind with the sun, similar problem. And finally of course cloud shadows moving quickly. These are things that Motion doesn't do well but in my opinion still gives fewer false triggers than Zoneminder.
Hmm, I've just realised I could configure two cameras in Zoneminder from the same feed and use Motion to trigger one and Zoneminder to trigger the other and see if I can improve things. Well I could but probably won't as I am quite happy.
I've just had a look down through the previous posts and one other feature that springs to mind with Motion is the ability of 'live' tweaking of the detection parameters as described in the Howto.
Well all a bit of a ramble and probably not enough reasons or answers but if you are even slightly tempted do give it a go.
Regards
Sledgehammer
MJN wrote:Sledgehammer,
Very interesting thread - for some reason I am intrigued to the point of wanting to give this a try... but I'm not sure why!
Whilst obviously respecting the hard work that has gone into both products, would you care to comment on the advantages (and disadvantages) on this dual approach?
I note you mentioned an overall drop in load... any other aspects of performance (ease of use, flexibility, false alarms etc) that stand out?
As a long-time ZM user I am very familiar with its operation but having never tried Motion can you think of anything, feature wise, that I might be 'missing' and would hence potentially benefit from by integrating as you have done?
Mathew
That's excellent - many thanks for taking the time to cover your experiences.
I'll give it a go... As you say it is so compartmentalised that I can introduce it in parallel to my existing setup.
One specific question if I may - one of the features I find very useful in ZM is its pre-event buffering i.e. it can record a period of time leading up to an event trigger firing. Will integration with Motion still allow this? I'm thinking that if Motion detects motion it'll trigger ZM to start recording... but only from that point in time...
Post-event buffering will presumably still be manageable by ZM as it will decide when to stop recording after a trigger ceases?
Mathew
I'll give it a go... As you say it is so compartmentalised that I can introduce it in parallel to my existing setup.
One specific question if I may - one of the features I find very useful in ZM is its pre-event buffering i.e. it can record a period of time leading up to an event trigger firing. Will integration with Motion still allow this? I'm thinking that if Motion detects motion it'll trigger ZM to start recording... but only from that point in time...
Post-event buffering will presumably still be manageable by ZM as it will decide when to stop recording after a trigger ceases?
Mathew
-
- Posts: 12
- Joined: Mon Dec 31, 2007 5:27 pm
pre and post event buffering are unaffected and work just how you would expect.
Just note my caveats on kernel versions and Zoneminder. I am currently running 2.6.20 as I have had no success with later versions. All related to video4linux2 I believe.
Sledgehammer
Just note my caveats on kernel versions and Zoneminder. I am currently running 2.6.20 as I have had no success with later versions. All related to video4linux2 I believe.
Sledgehammer
MJN wrote:
One specific question if I may - one of the features I find very useful in ZM is its pre-event buffering i.e. it can record a period of time leading up to an event trigger firing. Will integration with Motion still allow this? I'm thinking that if Motion detects motion it'll trigger ZM to start recording... but only from that point in time...
Post-event buffering will presumably still be manageable by ZM as it will decide when to stop recording after a trigger ceases?
Mathew