Thank you and zone sensitivity

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Thank you and zone sensitivity

Post by Greg_Talyor »

Just wanna say thank you to the developers and documentation writers.

My 1.34.20 on Debian 10.5 Buster works right out of the box. I yet to learn how to tweak this and that, but basically I have a working systems right away. There are three issues that I face initially. None of them is showstopper.

(1) ONVIF auto discovery works on one box but not the other.
(2) I can't quite manage setting up GPU vaapi as yet.
(3) Motion detection works great on cars and vehicles, but not so on people, bike riders, cats, hedgehogs, etc.

I am still working on the first two. Nevertheless, I find out the solution for the third one is well-documented. It turns out that I lacked common sense — people and objects that are further away from the camera look smaller on an image. Below is a quote that helps a newbie like me.

<https://wiki.zoneminder.com/Understandi ... or_Dummies>
"Understanding ZoneMinder's Zoning system for Dummies:
  Selecting the right values:
    Using percents
...
Zones and Depths: One of the learning for me was that don't make zones cover a lot of depth as far as the camera lens goes. Why? Well take a look at the image above. As a person or a pet walks away or towards the camera, it gets significantly bigger or smaller (right, that was not rocket science, but sometimes commonsense 101 helps)"

Ta.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Thank you and zone sensitivity

Post by asker »

Glad you liked the documentation on that. Note that if you are interested in object detection, you should also look at the ES with object detection. It now supports the coral edge TPU ($70) and object detection is made affordable without expensive GPUs
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: Thank you and zone sensitivity

Post by Greg_Talyor »

asker wrote: Mon Sep 07, 2020 9:53 pm Glad you liked the documentation on that. Note that if you are interested in object detection, you should also look at the ES with object detection. It now supports the coral edge TPU ($70) and object detection is made affordable without expensive GPUs
I have two 2MP cameras on an Intel i5 box, which averaging a load of 3.5 to 4.5 (on 4-core) and dropping lots of frames. The worst case I've seen was an 1.5 seconds gap between two alarm frames. It is likely because of my zone areas are way too large and sensitivity set too high. OTOH, I am also picking up too many shadows on the ground and overall brightness changes when the sun coming in and out of the clouds.

I don't even know TPU exists as a consumer device. Thanks for the tip. I have just ordered one. It costs 60 quids across this side of the pond. It is time to play with Event Notification Server when I don't quite manage Zoneminder basic settings. It'll be fun. I think (1) reducing demands on zones, and (2) getting VAAPI to work are the higher priorities to reduce CPU load for my setup at this moment.

I also have another annoying problem. It has nothing to do with Zoneminder but with Axis M3025-VE cameras. When I have IR filter on auto, a camera ticks — switching between day/night modes — like a clock (as in tick-tock, tick-tock) for good several minutes during dusk and dawn. Can't they just have their brightness sensors less accurate? The problem is more pronounced when I have WDR switched on. My workaround at the moment is switching IR filter off altogether. But it also means that I have B/W images all the time. I actual quite like colour images during daytime. I have seen some cameras have hysteria setting (e.g. Vicon <https://vicon-security.zendesk.com/hc/e ... umination->) on day/night mode switching, but I can't find it on my Axis cameras.

Ta.
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: Thank you and zone sensitivity

Post by Greg_Talyor »

Greg_Talyor wrote: Tue Sep 08, 2020 11:17 am The worst case I've seen was an 1.5 seconds gap between two alarm frames.
Even worse. I have a gap of 4 seconds between two consecutive alarm frames. The timestamps, that the camera put on and the one by Zoneminder, differ by 8 seconds. Not good. I wonder where to start to reduce them to more acceptable values for the worst case scenario.

00128-capture.png
00128-capture.png (462.78 KiB) Viewed 5215 times
00129-capture.png
00129-capture.png (358.61 KiB) Viewed 5215 times

Ta.
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Thank you and zone sensitivity

Post by burger »

Greg_Talyor wrote: Fri Sep 11, 2020 9:04 am Even worse. I have a gap of 4 seconds between two consecutive alarm frames. The timestamps, that the camera put on and the one by Zoneminder, differ by 8 seconds. Not good. I wonder where to start to reduce them to more acceptable values for the worst case scenario.
So the alarm event is skipping; i.e. it suddenly shows the car halfway through the picture... I had this issue with a 4K cam. The solution was to do mocord/modect on the low res stream at a low FPS, and then record the high res stream. Linked monitors is another option, if you don't want 24/7 record on the high res video.

Anytime I need to check footage, show timeline on the low res stream will be reviewed, and then the hi res stream can be pulled up at the same date/time. You will also want to be using x264 passthrough on the high res stream. The only downside so far, is that 24/7 record on a high res stream uses a lot of HDD space. Here's where a filter that limits HDD space per camera might be useful.

EDIT: Partitions for monitors is an easier way to manage per camera space usage.
Last edited by burger on Fri Sep 11, 2020 9:51 pm, edited 1 time in total.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: Thank you and zone sensitivity

Post by Greg_Talyor »

burger wrote: Fri Sep 11, 2020 2:15 pm So the alarm event is skipping; i.e. it suddenly shows the car halfway through the picture... I had this issue with a 4K cam. The solution was to do mocord/modect on the low res stream at a low FPS, and then record the high res stream. Linked monitors is another option, if you don't want 24/7 record on the high res video.

Anytime I need to check footage, show timeline on the low res stream will be reviewed, and then the hi res stream can be pulled up at the same date/time. You will also want to be using x264 passthrough on the high res stream. The only downside so far, is that 24/7 record on a high res stream uses a lot of HDD space. Here's where a filter that limits HDD space per camera might be useful.
H264 passthrough (.mp4) doesn't have those missing four seconds either.

I have a 64GB SD Card on each camera itself. It is recording 640x360 @15fps 24/7. I think, but I could be wrong, there are less dropped frames since these data does not need to go pass the ethernet cable. For example, at least I have some lo res images between the above two frames. I'm hoping 64GB would last for two weeks-ish.

I have two 2MP cameras (@10 fps set on camera) on a box with (I thought) pretty decent i5-6500T CPU @ 2.50GHz. I am hoping its 1TB HDD (95% of it, whereas root volume has 5%) would able to fit one-and-a-half to two weeks worth of MODECT footage. At first, I am not expecting performance problems. What I don't understand is that: On this forum, I read people having very modest CPUs [Raspberry Pi even] and a lot more cameras. They seem to work fine. Is there any chart/info on data throughput (res/fps) versus CPU power (flops or similar) available for Zoneminder?

I have tried to have the camera recording at 2MP onto its SD card, but it can't keep up and coughing up even less frames to the network.

I must be doing something very wrong with my zone and buffer settings. Any idea is welcome.

Ta.
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Thank you and zone sensitivity

Post by burger »

H264 Passthrough is used because it is less CPU intensive. It passes through raw H264 without processing. Disable JPEG saving, and use ffmpeg. If the recording can't keep up, lower FPS and resolution (on the camera - not ZM) until it is stable. SD Cards, in my experience, are not worth it. I have dash cams that outlast the 10K flash writes within months. And that is not driving 24/7. Maybe if you have a 1TB card, but I can't afford that. Also it requires changing periodically, which is maintenance. For CPU usage, ZMA (analysis) uses substantially more CPU than ZMC (camera record). Think about it: It has to do math on each frame to compute a motion score, whereas recording is only copying bytes. Try limiting analysis FPS to 1 or 2. Make zones as small as possible, and don't make a lot of zones.

If you do modect, you may miss events, so I prefer mocord.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: Thank you and zone sensitivity

Post by Greg_Talyor »

Thanks for the tips.
burger wrote: Fri Sep 11, 2020 9:49 pm Disable JPEG saving, and use ffmpeg.
That makes a lot of sense. Why didn't I think of that before?

Before: ZMC ~30% CPU per camera, ZMA ~20%
After: ZMC unchanged, ZMA ~8%
Load is reduced from to ~2.6 to ~1.8 (on a 4-core)

Still losing some frames, but not as severe as before. Possibly about 1/2 second max when I look at a few random clips. Just to it mention again, 10 fps is set on the camera.
burger wrote: Fri Sep 11, 2020 9:49 pm SD Cards, in my experience, are not worth it. I have dash cams that outlast the 10K flash writes within months.
Too true. I don't fancy climbing walls too often. In fact, I haven't put the cameras up as yet. My main problem is running cables. My loft is not boarded. I either need to partially board it or I need to be very careful with my steps. I don't fancy pushing my legs thru' the ceiling.
burger wrote: Fri Sep 11, 2020 9:49 pm If you do modect, you may miss events, so I prefer mocord.
I find lots of footage overwhelming. I have about 1-second pre-event and 1-second post-event buffers. That possibly is one of the reasons why my CPU load is so high. On this BBS, I read about using existing footage to tune zone/sensitivity settings. It looks promising and I will look into it once I sort out some other things. I have my Coral Edge arrived. My fingers are really itchy to have a go.

I've been using Linux since Woody/Sarge mainly on some number crunching. Before that I used a little Solaris and Irix, and quite a lot DEC Alpha as a user. I have never done any sysadmin thing at all. I think I am barely managing installing Zoneminder. It is a pity that a typical Windoze user might not able to cope.

BTW, I have a fully working VT120 with manual for sale. I had been using it as the console for a Woody box for a few years. I wonder which selling site might give me a better chance of a sale.

Ta.
sfritz
Posts: 9
Joined: Sun Aug 16, 2020 4:14 am

Re: Thank you and zone sensitivity

Post by sfritz »

I set up one each Amcrest 5MP and 8MP cameras as per this older post:

viewtopic.php?f=10&t=29853

However, I monitored it with zabbix and determined there were still hardware bottlenecks on the Raspberry Pi 4; the SD Card IO bottleneck was the critical issue because I was getting high CPU iowait percentages and frames were backing up in memory (resulting in frequent zoneminder frame buffer warning and error logging) because they could not be written to the attached USB 3.0 hard disk quickly enough. This persisted even when I increased the Zoneminder frame buffers and OS /dev/shm size for each camera

I just rebuilt the system. I installed the latest Raspberry Pi OS to an SD Card, updated the firmware and set it to boot from USB. The USB 3.0 thumb drive runs Ubuntu 20.04 server and it is still writing to a USB 3.0-attached hard disk. The disk IO and CPU iowait issues are pretty much resolved. There is also less lag in viewing and recording the camera streams. I can probably add a second 5MP camera.
Attachments
Screenshot from 2020-09-24 08-50-46.png
Screenshot from 2020-09-24 08-50-46.png (59.92 KiB) Viewed 5016 times
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: Thank you and zone sensitivity

Post by Greg_Talyor »

burger wrote: Fri Sep 11, 2020 9:49 pm If the recording can't keep up, lower FPS and resolution (on the camera - not ZM) until it is stable.
With my setup, I'm mildly disappointed that capture and analysis rates are quite low comparing to my unfounded expectations before getting my gears.
  • i5-6500T CPU @ 2.50GHz
  • RAM: 8GB
  • Number of cameras: 2
  • Resolution: 2MP
  • Source type: Ffmpeg
  • Function: MoDect
  • Save JPEGs: Analysis images only (if available)
  • Video Writers: H264 Camera Passthough
  • Capture rate set at cameras: 8 fps
  • Analysis FPS set at Zoneminder: 4 fps
I really need to look into how to set up VAAPI and/or Coral. Any tips are welcome.

Ta.
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Thank you and zone sensitivity

Post by burger »

Get rid of JPEG analysis images, do modect only on the low res stream, and record on the high res stream (or nodect via linked monitors). Make sure X isn't running... Disable speculative execution mitigations... There's always tuning that can be done.

Consumer motherboards / CPUs don't fair too well with high CPU computing. This is expected behavior. This is why high performance workstations in small/medium businesses use server class cpus instead of i-whatever. Although you can probably get more than 2 cameras. I run 3 cameras (two 800x600, and one 2K) on a core 2 duo for example.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Post Reply