CameraEvents Service - Dahua Events to mqtt

Joined
Sep 12, 2017
Messages
16
Reaction score
10
Hey @psycik

Just found your docker container CameraEvents which works great with my camera's, thanks so far. I connected my tripwires to Domoticz, very nice.

I was wondering how you do this;

Can post an image into the mqtt payload also (which jpmens/mqttwarn can post to slack and pushover).

Can you maybe add a picture of your nodered on how you do this ?

Raymond
 

psycik

Getting the hang of it
Joined
Dec 9, 2015
Messages
221
Reaction score
37
Location
Wellington, New Zealand
I don’t use nodered.
But do it with that you’d have to read the payload sent from camera events. One part is a message, the other is a base64 encoded image.

If nodered can convert that to a binary then it should have a notification service with attachments it can use.
 
Joined
Dec 27, 2018
Messages
3
Reaction score
0
Location
California
Hey @psycik

Just found your docker container CameraEvents which works great with my camera's, thanks so far. I connected my tripwires to Domoticz, very nice.

I was wondering how you do this;

Can post an image into the mqtt payload also (which jpmens/mqttwarn can post to slack and pushover).

Can you maybe add a picture of your nodered on how you do this ?

Raymond
You can use Node-Red to save the base64 encoded image as a jpg file. I'm using Pushover so I just take that file and set msg.attachment to the path of the image to send using the Send Pushover node.
 

Attachments

tpham3783

n3wb
Joined
Mar 3, 2020
Messages
2
Reaction score
0
Location
atlanta
This is very good work, the fact that it is event driven directly from the camera.

I would like to know if it is possible to get the following events:

1. Filename (and path) of the last jpg image that was saved on sd/ftp/nas
2. Likewise, the last filename of the mp4 that was saved to ftp or nas.


If it is possible using rest api of Amcrest, let me know so that I can go ahead and work on it.


thanks,
 

psycik

Getting the hang of it
Joined
Dec 9, 2015
Messages
221
Reaction score
37
Location
Wellington, New Zealand
This is very good work, the fact that it is event driven directly from the camera.

I would like to know if it is possible to get the following events:

1. Filename (and path) of the last jpg image that was saved on sd/ftp/nas
2. Likewise, the last filename of the mp4 that was saved to ftp or nas.


If it is possible using rest api of Amcrest, let me know so that I can go ahead and work on it.


thanks,
I did start working on the media find capabilities of the NVR/Camera. I was going ot use it since I have a fairly long delay generating a snapshot ( + 5-10 seconds). And I was going to use the media find to do it. But the time after the IVS event triggers and a video/snapshot appears on the internal disk of the NVR was hard to determine.

But there is the framework of the media find messages (in the alarm-local) branch, that might be expanded to return that information, or the image.....but it wouldn't be an event. It would be a message call from something eg cameraevents/nvr/getmedia with payload "yyyymmddThh:mm:ss"
 

tpham3783

n3wb
Joined
Mar 3, 2020
Messages
2
Reaction score
0
Location
atlanta
I did start working on the media find capabilities of the NVR/Camera. I was going ot use it since I have a fairly long delay generating a snapshot ( + 5-10 seconds). And I was going to use the media find to do it. But the time after the IVS event triggers and a video/snapshot appears on the internal disk of the NVR was hard to determine.
I observe that putting an image resource onto MQTT is very inefficient for many reasons: 1. mqtt is not designed to handle alot of data (especially binary data of an image). 2) If an image item of openhab is linked to an mqtt broker channel, It is going to slow down openhab mobile (or even desktop) viewer by 70+ folds. What i have been doing is that I run a webservice that detects all new images from my amcrest webcam clusters, and then transcode them on the fly to lower resolution. If the detected resource is an mp4 file, the service transcodes the mp4 into animated gif 89, so that it can be viewed on openhab mobile devices w/o much bandwidth overhead.

If I have time, I am going to merge my work w/ your work so that it would be more beneficial and easier to maintain.



But there is the framework of the media find messages (in the alarm-local) branch, that might be expanded to return that information, or the image.....but it wouldn't be an event. It would be a message call from something eg cameraevents/nvr/getmedia with payload "yyyymmddThh:mm:ss"
OK, i'll investigate into this. Presently, I am using inotiify library to detect new uploads from amcrest devices. This is efficient, but not good because like you noted, Timing is not anywhere close to near real time, anywhere from 1-30 seconds. In some other instances, I've been getting false events like a few hours off because *i think the cameras actually remodify the content of those files.
 

psycik

Getting the hang of it
Joined
Dec 9, 2015
Messages
221
Reaction score
37
Location
Wellington, New Zealand
Yes I realise mqtt isn’t the best for binary data. But it does actually work well (annoying to look through the logs though.

I should figure out a cameraevent to openHAB. If I can get the payload to a memory stream to image. It should work. Similar with home assistant.
Ideally I’d prefer to not load up cameraevents with notification libraries. As said before mqttwarn does a great job of this, and I updated the push over and slack services to take the mqtt payload for image.
 
Joined
Jul 14, 2018
Messages
28
Reaction score
7
Location
New Zealand
Anyone want to add support for audio events (AudioMutation & AudioAnomaly) here is a sample.

Code:
events=VideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure,Audio,AudioAlarm,AudioEvent,AudioIntensity,AudioIntensityChange,IntensityChange
AudioMutation:
Code:
2020-07-02 12:50:46,269 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:01,253 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:51:01,254 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:02,256 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0
AudioAnomaly:
Code:
2020-07-02 12:50:39,803 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:50:42,259 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:37
Code=AudioAnomaly;action=Stop;index=0

2020-07-02 12:50:42,259 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:50:45,868 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0
I presume audiomutation is audiointensity change and audioanomaly is audiodetection, although it might be the other way around.
 

CHILLXXL

n3wb
Joined
Jan 3, 2021
Messages
2
Reaction score
0
Location
Netherlands
Great work that there is this app. Since I am on a tipping point to buy a DVR (or Synology NAS) a have couple of questions;
  • Does this work with the newest Dahua DVR's like the NVR2108HS-8P-I
  • (technical; just curious) Is this a pull/fetch system from the python script towards the Dahua API on the DVR that checks every 'x' seconds if an event took place and then publishes a MQTT message or does the DVR pushes a event-call to the python scripts. What delay from even to MQTT broadcast is expected?
  • Are face detect/recognition events also received?
  • Are 'human' / 'Motor vehicle' (SMD plus) events differentiated?
 
Last edited:

psycik

Getting the hang of it
Joined
Dec 9, 2015
Messages
221
Reaction score
37
Location
Wellington, New Zealand
Great work that there is this app. Since I am on a tipping point to buy a DVR (or Synology NAS) a have couple of questions;
Does this work with the newest Dahua DVR's like the NVR2108HS-8P-I
I wouldn't know until someone tries it. I doubt their api would change that much I'd expect so
(technical; just curious) Is this a pull/fetch system from the python script towards the Dahua API on the DVR that checks every 'x' seconds if an event took place and then publishes a MQTT message or does the DVR pushes a event-call to the python scripts. What delay from even to MQTT broadcast is expected?
No, it's an event attached to so when events happen the service is notified.
Are face detect/recognition events also received?
I believe they might be attachable, the issue would be figuring out the keyword for the event list (eg VideoMotion for Motion event, CrossLineDetection etc)
Are 'human' / 'Motor vehicle' (SMD plus) events differentiated?
On my system I get a json string with the event that lists things like human, smoke, vehicle. If that's what you mean. I add those into the message, but they're not currently filterable.
 

trollmar

n3wb
Joined
Feb 9, 2017
Messages
25
Reaction score
0
Hi,


I would like to use this script to trigger BlueIris Mqtt Interface.
BlueIris has a strict mqtt trigger command and payloads.

For example:
When i like to trigger a CAM called "floor1"
the mqtt has to be:
BlueIris/admin/camera=floor1&trigger

Does anybody know how to rewrite/remap MQTT Messages or to tweak CameraEvents to archiev this goal?
 

psycik

Getting the hang of it
Joined
Dec 9, 2015
Messages
221
Reaction score
37
Location
Wellington, New Zealand
Hi,


I would like to use this script to trigger BlueIris Mqtt Interface.
BlueIris has a strict mqtt trigger command and payloads.

For example:
When i like to trigger a CAM called "floor1"
the mqtt has to be:
BlueIris/admin/camera=floor1&trigger

Does anybody know how to rewrite/remap MQTT Messages or to tweak CameraEvents to archiev this goal?
What is the topic?
BlueIris/admin/camera=floor1
or BlueIris/admin/camera
?

And mqtt payload? if trigger, or is it floor&trigger

Unless you want to put something in to rewrite the alerts from cameraevents (maybe mqttwarn could do it) into blue iris format, it'd have to be added to cameraevents.
 

trollmar

n3wb
Joined
Feb 9, 2017
Messages
25
Reaction score
0
Hi,
in my example it is:

Topic: BlueIris/admin
Payload: camera=floor1&trigger

I think a general BlueIris integration would be a great add-on to CameraEvents.
 

SergeyAU

Getting the hang of it
Joined
Feb 20, 2017
Messages
192
Reaction score
22
anything similar available for NVRs? I only have rstp streams exposed and ONVIF is only available to the NVR itself
 
Top