waynieack / hikvisionzm Goto Github PK
View Code? Open in Web Editor NEWHikvision ZoneMinder plugin to use in camera motion detection
Hikvision ZoneMinder plugin to use in camera motion detection
Hi, after some random time it stops recording to storage device even the plugin keeps sending VMD events. This problem seems to appear in version 1.36.x and forward, at 1.34.x it was working perfectly. Killing motionstream's PID and starting again is enough to record again but after some random time the problem repeats.
As additional data:
Raspbian, ZM 1.34 = works ok.
CentOS 7, ZM 1.36 = stops recording.
Fedora 33, ZM 1.37 = stops recording.
Awesome script, it's working for me after a little hacking. The H.264 supported method for configuring these cameras is to use ffmpeg. Unfortunately this populates the Path
field instead of the Host
field with the camera credentials in the Monitors
table. It's also a different format than the script is expecting.
I noticed if I switched to remote as suggested, the script worked but I could no longer see video. However, when I switched back to ffmpeg, the script still worked! Looking deeper in the database, ZM appears to leave the configuration in the Host
field even though it switches the type
back to Ffmpeg
. I went into the database and ran select Host,Path,Id,Name,Function from Monitors where find_in_set( Function, 'Modect,Record,Nodect,Mocord' );
I then manually updated each Host
field to include the scripts preferred format user:password@ipaddress
(hostnames don't work). update Monitors set Host = 'user:[email protected]' where Id = 10;
The Id comes from your previous query.
I have got following errors when events occurs with Zoneminder v1.32.3:
ERR [ZoneMinder::Memory::Mapped:150] [Can't read from mapped memory for monitor '6', gone away?]
ERR [ZoneMinder::Memory::Mapped:150] [Can't read from mapped memory for monitor '6', gone away?]
Some perl libs in v1.32 are broken now?
After 12+ hours of running the script, CPU usage starts to go up and the following error repeats in the logs
ERR [Memory map file '/dev/shm/zm.mmap.' does not exist. zmc might not be running.] Jun 25 10:34:36 zmbox motionstream.pl[20369]: Use of uninitialized value in concatenation (.) or string at /home/jshank/HikvisionZM/motionstream.pl line 307. Jun 25 10:34:39 zmboxmotionstream.pl[20369]: Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Memory/Mapped.pm line 87.
I have pretty frequent restarts of the zmc processes but it doesn't look like the script is handling them gracefully.
Wayne, thanks for putting together this nice script! I'm working with it now. Two issues that I found: I have interpreted this "_mol-" to be a substring, though within the code it's actually confirms your example that it requires it to be at the end. So I changed the script to search it as a substring so that I could use it as "hik_mol-01".
Second one was ISAPI in the REST API path. It turned out that it's not required on my camera, and I get "connection reset by peer" if I use it. So I had to remove ISAPI from the two places it's used in the code.
In the next couple of days I'll be testing it with two cameras, so I'll let you know about the multithreaded support that you have added.
PS: Hit me up on Skype if you'd like, will be glad to give you details as I go.
Hello, thank you for your work on this program! I am starting this script fine, but it seems to not be receiving PIR events from my Hikvision 2432 camera. I know the camera is triggering its own events as verified by the "Audible Warning", but I'm not sure if the camera is proving the needed XML.
When I curl -s -S -N -u zmuser:zmpass http://192.168.1.45/ISAPI/Event/notification/alertStream
I get the following which keeps updating.
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 480
<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.1.45</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:58:be:6e:53:0c</macAddress>
<channelID>1</channelID>
<dateTime>2016-07-19T19:24:46--8:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 480
<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.1.45</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:58:be:6e:53:0c</macAddress>
<channelID>1</channelID>
<dateTime>2016-07-19T19:24:46--8:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.