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
172
Reaction score
26
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
172
Reaction score
26
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
172
Reaction score
26
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.
 
Top