IP Camera Motion Detection

Forum for questions and support relating to the 1.27.x releases only.
Post Reply
Mad Professor
Posts: 106
Joined: Wed Dec 15, 2010 11:20 am
Location: Isle Of Wight, UK

IP Camera Motion Detection

Post by Mad Professor » Thu Aug 21, 2014 3:22 pm

Good day all.

As per the topic title I am looking for help and advice with regards to Motion Detection with IP Camera's.

The current set-up is using analog cctv cameras, I am in the middle of upgrading the system with IP POE Camera's.

I have been using ZoneMinder to record 24/7 and detect movement with the analog cctv cameras.

The new IP POE Camera's have built-in motion detection, and are able to send a trigger output / signal when movement has been detected.

The camera's in question are Hikvision DS-2CD2032-I with firmware V5.1.6 build 140412.

Via the Camera's WEB UI: Configuration > Advanced Configuration > Events > Motion Detection

I am greeted with a page with the following Tick Boxes.

*Enable Motion Detection
*Enable Dynamic Analysis for Motion

Normal Linkage
*Notify Surveillance Center
*Send Email
*Upload to FTP
*Trigger Channel

Other Linkage
*Trigger Alarm Output

I know I could carry on using ZoneMinder to do the Motion Detection on the new IP POE Camera's, but this is going to put extra cpu and memory loads on the server.

Is anyone able to give any guidance regarding this.

Thanks for your time.

Best Regards.

carcachute
Posts: 38
Joined: Wed Jul 23, 2014 12:21 am

Re: IP Camera Motion Detection

Post by carcachute » Thu Aug 21, 2014 5:07 pm

Mad Professor wrote:Good day all.
...
I know I could carry on using ZoneMinder to do the Motion Detection on the new IP POE Camera's, but this is going to put extra cpu and memory loads on the server.
I don't think ZM can read extra alarms (such as motion or GPIO) from IP cameras, but I recently saw a feature request for that capability under the umbrella of full ONVIF compatibility. I have only cheesy D-Link IP cameras, but their video motion detection is not very configurable and I have been unhappy with the number of false triggers. They will trip themselves when the IR cut filter changes or when the sun goes behind a could, and the only thing you can do is desensitize it. That's why I switched to ZoneMinder. Most IP cams are probably similarly primitive. My cams do have onboard PIR sensors and it would be nice to trigger ZM off those.

One thing that seems to work for me is using linked monitors to perform motion detection at reduced resolution and framerate. Set your main high-res feeds to NODECT. Then add separate low-resolution monitors from the same cameras using MODECT, and link the NODECT feeds to them. For example, my cams can stream 3 or 4 different resolutions (called "profiles") simultaneously, so I pull from the high-res 640x480 or 1080p streams using NODECT, and do the motion detection on 320x240 and 480x270 at 6 or 7 fps. This gives me 15% idle CPU load on an Atom D510 1.6 GHz computer.

zonestorm
Posts: 2
Joined: Wed Jul 27, 2016 9:34 pm

Re: IP Camera Motion Detection

Post by zonestorm » Thu Jul 28, 2016 12:36 pm

Using the low-res stream for motion detection seems like a good idea.
Is it possible in zoneminder to use the alarm on the low-res stream to record the high-res stream?

AmIparanoidEnough?
Posts: 4
Joined: Sun Mar 03, 2019 10:45 pm

Re: IP Camera Motion Detection

Post by AmIparanoidEnough? » Sun Mar 03, 2019 11:06 pm

In-camera motion detection and 4K cameras are becoming more common, and using the hardware assisted motion detection in the cameras will be much more efficient than using ZM to monitor multiple 8MP video streams. Has any progress been made on this?

Dingbatca solved it by running a shell script on the camera (see https://ipcamtalk.com/threads/zoneminde ... -to.11017/), but the V5.5 HiKvision firmware no longer has an option to enable SSH. Does anyone know how to enable SSH on newer HiKvision camers?

Zonestorm's suggestion of letting ZM watch a lower-res stream and record the high-res stream sounds like a reasonable compromise; has anyone gotten that to work?

My HiKvision camera has several possible actions when it detects motion, including:
1) Notify Surveillance Center: Send an exception or alarm signal to remote management software when an event occurs.
Does anyone have any idea what kind of message this would be? SNMP?
2) Upload to FTP
Could ZM use this as a trigger to start recording? Give each camera a unique FTP location, have a script watching for a file to appear, and start recording the stream associated with that location, then delete the file.

If there is a more recent thread on this topic then I apologize for resurrecting this one, but I didn't find a better place to put my questions.

AmIparanoidEnough?
Posts: 4
Joined: Sun Mar 03, 2019 10:45 pm

Re: IP Camera Motion Detection

Post by AmIparanoidEnough? » Tue Mar 05, 2019 1:13 am

I finally found in the HiKvision manual that the camera can in fact generate an SNMP trap when it detects motion. It says "By setting the Trap Address, the
camera can send the alarm event and exception messages to the surveillance center."

There isn't any documentation in the manual about the information that is passed in the trap, but I will log it and post it here. Given that, I think it should be fairly easy to write a script to parse the trap information and tell ZM what to do about it. Install net-snmp on the ZM server, add some scripts, configure the HiKvision cameras to do motion detection and send an SNMP trap when motion is detected, and CPU utilization on the ZM server should be very low.

Where can I find documentation explaining how to write a script to trigger actions in ZM? Are there any SNMP Trap Daemon gurus who would like to help?

User avatar
snake
Posts: 142
Joined: Sat May 21, 2016 2:20 am

Re: IP Camera Motion Detection

Post by snake » Tue Mar 05, 2019 6:02 pm

AmIparanoidEnough? wrote:
Tue Mar 05, 2019 1:13 am
Where can I find documentation explaining how to write a script to trigger actions in ZM?
There are two (maybe three) ways of doing this.

1) ZMTrigger
2) API

ZMTrigger is a telnet daemon, so you'd simply interact with that via your script. It must be enabled, it's not on by default. See http://wiki.zoneminder.com/ZMTrigger

The API is http via apache + CakePHP, so you might throw in some calls to curl in your script somewhere. See the official documentation on the API: https://zoneminder.readthedocs.org/

The 3rd option would be to edit the ZM source code, but that's going a bit beyond the previous two options.

AmIparanoidEnough?
Posts: 4
Joined: Sun Mar 03, 2019 10:45 pm

Re: IP Camera Motion Detection

Post by AmIparanoidEnough? » Wed Mar 06, 2019 1:00 am

Excellent explanation; thank you Snake! This is very helpful. I don't think I will get to it right away, but it looks like it will be easier than I expected.

canbikehere
Posts: 14
Joined: Tue Feb 27, 2018 6:09 pm

Re: IP Camera Motion Detection

Post by canbikehere » Mon Mar 18, 2019 5:47 pm

AmIparanoidEnough? wrote:
Sun Mar 03, 2019 11:06 pm

Zonestorm's suggestion of letting ZM watch a lower-res stream and record the high-res stream sounds like a reasonable compromise; has anyone gotten that to work?
I use this approach with all my cameras.

The 'main' streams are configured as 'Nodect' while the 'sub' streams are configured as 'Modect' or 'Mocord'. The high-res 'main' stream is linked to the substream. Analysis is cheap this way, and motion detection has been very reliable for me.

The other benefit to this approach, is if you use something like ZMNinja on your phone you can just have it looking at the substreams rather than the high res feeds. Less bandwidth when reviewing videos!

AmIparanoidEnough?
Posts: 4
Joined: Sun Mar 03, 2019 10:45 pm

Re: IP Camera Motion Detection

Post by AmIparanoidEnough? » Sun Mar 24, 2019 9:55 pm

Option #2 above (use an motion-activated FTP upload from the camera to trigger ZoneMinder recording) doesn't appear to be a real option; I have been completely unable to get the camera to connect to vsftpd. I have tried _lots_ of different configurations, and once - exactly once - the camera said that it was unable to create the directory for the picture.

Every other time the camera says that it was unable to login - "User Name or Password Error", or something to that effect. My first attempt was an anonymous login; the camera always reports failure, and the vsftpd log always shows "OK Login".

I tried this with two cameras:
- an OEM version (DT185-I) running V5.5.80 firmware
- DS-2CD2185FWD-I running V5.5.61 firmware

Since anonymous login didn't work I then tried logging into an actual user account; both the camera and vsftpd agreed that that failed.

Let's face it; HiKvision does very, very little testing on the camera firmware. I am sure they test it with their own NVR, and they probably don't do much beyond that.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests