I'm trying to use the "Animation" option wtih zm event server, but I'm unsuccessfull. An animation is created but is always black and is a couple of seconds long.
I run on Ubuntu 22.04.
ZM: version 1.36.33 / "apiversion":"2.0"
zmeventnotification last stable version v6.1.27.
Python 3.10.6
openCV version '4.7.0'
ffmpeg version 4.4.2
Objectconfig.ini:
[animation]
create_animation=yes
animation_types='mp4'
animation_width=640
animation_retry_sleep=15
animation_max_tries=4
fast_gif=no
Secrets.ini (I put it here, but I think this is not relevant, as the link is working, but the animation itself is not working)
[secrets]
ZMES_PICTURE_URL=http://*zmServeIP*/zm/index.php?view=image&eid=EVENTID&fid=objdetect_mp4&width=600
I know ZM run with the user www-data, but in order to test the behaviour, I have run the following command with sudo:
Code: Select all
sudo /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 2968 --monitorid 7 --debug
Code: Select all
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 zm_detect.py:481 [Prediction string JSON:{"labels": ["person"], "boxes": [[602, -1, 800, 531]], "frame_id": "snapshot", "confidences": [0.8874325752258301], "image_dimensions": {"original": [480, 640], "resized": [600, 800]}}]
[s] detected:person:89% --SPLIT--{"labels": ["person"], "boxes": [[602, -1, 800, 531]], "frame_id": "snapshot", "confidences": [0.8874325752258301], "image_dimensions": {"original": [480, 640], "resized": [600, 800]}}
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 zm_detect.py:545 [animation: Creating burst...]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:37 [animation: Try:1 Getting http://*zmServeIP*/zm/api/events/2968.json?username=admin&password=***]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:74 [animation: Got 165 frames]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:83 [animation: event fps=12]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:88 [animation: anchor=snapshot start=45 end=165 skip=6]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:89 [animation: Grabbing frames...]
04/09/23 09:36:40 zmesdetect_m7[3130183] DBG1 image_manip.py:95 [Grabbing anchor frame: snapshot...]
04/09/23 09:36:41 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:45]
04/09/23 09:36:42 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:51]
04/09/23 09:36:43 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:57]
04/09/23 09:36:44 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:63]
04/09/23 09:36:44 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:69]
04/09/23 09:36:45 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:75]
04/09/23 09:36:46 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:81]
04/09/23 09:36:47 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:87]
04/09/23 09:36:48 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:93]
04/09/23 09:36:49 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:99]
04/09/23 09:36:50 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:105]
04/09/23 09:36:51 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:111]
04/09/23 09:36:52 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:117]
04/09/23 09:36:52 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:123]
04/09/23 09:36:53 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:129]
04/09/23 09:36:54 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:135]
04/09/23 09:36:55 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:141]
04/09/23 09:36:56 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:147]
04/09/23 09:36:57 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:153]
04/09/23 09:36:58 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:159]
04/09/23 09:36:59 zmesdetect_m7[3130183] DBG2 image_manip.py:106 [animation: Grabbing Frame:165]
04/09/23 09:37:00 zmesdetect_m7[3130183] DBG1 image_manip.py:112 [animation: Saving /objdetect...]
04/09/23 09:37:00 zmesdetect_m7[3130183] DBG1 image_manip.py:115 [Creating MP4...]
04/09/23 09:37:00 zmesdetect_m7[3130183] DBG1 image_manip.py:120 [animation: saved to /objdetect.mp4, size 2425 bytes, frames: 21]
04/09/23 09:37:00 zmesdetect_m7[3130183] DBG1 zm_detect.py:557 [Closing logs]
So I begin to search in image_manip.py (probably line 118 with imageio.mimwrite is doing something weird), but I can't figure it out. Could it be that the frame rate or the video size change make troubles when creating the animation?
Strangely enough, the option "Generate Video" on the zm Web UI works like a charm, mp4 and gif.
Any idea why the animation is not created properly by the Event Server?
Cheers
Alex