Help please for a new start with motion detection v 1.36

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

Help please for a new start with motion detection v 1.36

Post by cookiemonster »

Hello and wishing everyone a good 2022.
I've been running ZM v 1.34 for about 1.5 years I think and although my motion detection was very imperfect, it was acceptable. What I had was many false positives and few misses.
I had the opportunity of the Xmas break from work to do all those upgrades I need time for and can only do then. For this part of my home setup I was able to upgrade the Operating System, which allowed me to build ZM on a newer version. All this is done and after dealing with issues with the new database for ZM and the nginx config, I am up and running on version 1.36.5.
The plan was to create new installation and transplant by hand the cameras' settings and zones before tweaking. The plan has failed me, I'm guessing the new version of ZM requires me to start from scratch. What happened with the old motion settings was that no events were recorded.
This is what brings me here. A good reminder of how hard it can be for me to get motion setup.

I have started as usual with the wiki https://wiki.zoneminder.com/index.php/U ... or_Dummies and a couple of notable forum posts like http://forums.zoneminder.com/viewtopic.php?f=32&t=23024 and it's referenced viewtopic.php?f=11&t=22239&p=84476#p84476.
I have failed over the last few days to get my first step: getting low values enough to capture anything on Alarmed Pixels, and the same result with any of the presets. Cameras are in Modect. They are outdoor and their default Reference Image Blend 12.5% outdoor, Alarm Reference Image Blend %ge 6.25%, Analysis is enabled.
I have two outdoor cameras, the streaming and live view works perfectly. They overlook two different areas so I'm clear the settings will need to differ.
I seek your assistance to figure one out so I can use the method for the second.

This is my front camera. I have only one zone enabled that I want to figure out the motion for. Currently no events are recorded on Default or Best, high sensitivity. What do you recommend I set it to to begin with? The camera is streaming at 6fps from source at 2560X1920 pixels & 24 bit colour.
Thanks in advance.

Image
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

Re: Help please for a new start with motion detection v 1.36

Post by cookiemonster »

I think I have something to go with.
I've removed the zone. Created a new one with the whole area and set it to the best,high sensitivity preset. Nothing recorded when people appeared moving in the scene. I was able to force an alarm with a person in the main focus area and I got no recording but a bunch of:

Code: Select all

Socket /var/run/zm/zms-485974s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.
which I was sure I had resolved with in the nginx config. I see a load of zm-[6digits].lock files in /var/run/zm/ and the directory is owned by www:www
I'm investigating this. Maybe the alarms are failing to record for this reason.
And the particular file it was lookiing for in this forced alarm is there:
-rw------- 1 www www 0B Jan 4 10:25 zms-485974.lock

Any ideas welcome.
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

Re: Help please for a new start with motion detection v 1.36

Post by cookiemonster »

I am at a loss here.
Does ZM use different socks paths for motion detection and forced alarms? I am troubleshooting no alarms recorded. I have forced an alarm and I can see it recorded frames as expected but just before it I can see in the logs some errors. I am trying to narrow down from logs differences in forced alarms and ones from detected motion:
After forcing the alarm:

Code: Select all

2022-01-04 12:06:19	web_php		87761	ERR	Socket /var/run/zm/zms-371320s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early
2022-01-04 12:06:17	zms_m2		101753	WAR	Unable to send stream frame: Broken pipe
2022-01-04 12:06:12	zmc_m2		101902	ERR	Error writing trailer Error number 200 occurred
2022-01-04 12:06:00	zmc_m2		101626	INF	Front: 10931 - Gone into alarm state PreAlarmCount: 0 > AlarmFrameCount:1 Cause:Forced Web
Just before forcing it and I'm wondering if this is a sign why no motion is recorded:

Code: Select all

2022-01-04 12:05:57	web_php		2253	ERR	Socket /var/run/zm/zms-689409s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early.
2022-01-04 12:05:55	zms_m2		101673	WAR	Unable to send stream frame: Broken pipe
I am most confused as the logs suggest the same path for both. The .sock files do exist. Where do I need to look for more clues please? My config settings:
/usr/local/etc/zoneminder/01-system-paths.conf

Code: Select all

ZM_PATH_SOCKS=/var/run/zm
/usr/local/etc/nginx/nginx.conf

Code: Select all

        location /cgi-bin/nph-zms {
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
        }        location /zm {
                alias /usr/local/www/zoneminder;
                location ~ \.php$ {
                        if (!-f $request_filename) {return 404; }
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php-fpm.sock;
/usr/local/etc/php-fpm.conf

Code: Select all

listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660
env[PATH] = /usr/local/bin:/usr/bin:/bin 
I'm watching for clues. I just had a lot of people in front of a camera. An alarmed event should have occurred. There is only one zone like the default, all area, with preset best.
Front UI had no alarm recorded. Going to that monitor by selecting from there showed the state as idle. Going to the Logs it shows State: alarm. First clue that is perhaps trying to record alarms. But loads of errors. These seems to be the relevant:

Code: Select all

2022-01-04 13:36:31	web_php		67742	ERR	Socket /var/run/zm/zms-691989s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early.
2022-01-04 13:36:31	web_php		67743	ERR	Socket /var/run/zm/zms-691989s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early.
2022-01-04 13:36:31	web_php		76382	ERR	Socket /var/run/zm/zms-691989s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early.
2022-01-04 13:36:29	web_php		76349	ERR	socket_bind( /var/run/zm/zms-691989w.sock ) failed: Address already in use
2022-01-04 13:36:29	web_php		76349	WAR	sock file /var/run/zm/zms-691989w.sock already exists?! Is someone else talking to zms?
2022-01-04 13:36:29	web_php		73123	ERR	Socket /var/run/zm/zms-691989s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early
2022-01-04 13:36:29	web_php		67742	ERR	socket_bind( /var/run/zm/zms-691989w.sock ) failed: Address already in use
2022-01-04 13:36:28	web_php		67742	WAR	sock file /var/run/zm/zms-691989w.sock already exists?! Is someone else talking to zms?
2022-01-04 13:36:11	zms_m1		101663	WAR	Unable to send stream frame: Broken pipe
2022-01-04 13:36:11	zms_m1		101774	WAR	Unable to send stream frame: Broken pipe
2022-01-04 13:35:56	zms_m1		101663	WAR	Unable to send stream frame: Broken pipe
2022-01-04 13:35:46	zms_m1		101648	WAR	Unable to send stream frame: Broken pipe
Please help with what to look at. Live view and thumbnails work fine. System rebooted earlier today .
Magic919
Posts: 854
Joined: Wed Sep 18, 2013 6:56 am

Re: Help please for a new start with motion detection v 1.36

Post by Magic919 »

I would configure with the settings that were fine on the old version and go from there. The presets you mention are not really used with recent cameras, but the 'dummies guide' is valid.
-----------------------------------------------------------------------
I'm nothing to do with ZM, ZMNinja or ZMES, I just use them.
Contribute funding to the devs here - https://opencollective.com/zoneminder
User avatar
iconnor
Posts: 1908
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Help please for a new start with motion detection v 1.36

Post by iconnor »

You have many issues.

First off, the sock files have nothing to do with motion detection. They are a means of php communicating with the zms process to tell it to do things and get status information.

As to motion detection, the defaults were set back in the day when cameras were 320x200 resolution and are garbage these days. Set the units to pixels and lower all the minimums to 1000. Then see how you go raise if too sensitive, lower if still missing motion.

I have to assume that since you are on 1.36.5 you are running the official debian packaged version as opposed to our packages that we host on zmrepo.zoneminder.com I would suggest giving ours a try.
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

Re: Help please for a new start with motion detection v 1.36

Post by cookiemonster »

Thank you both. This is why it's confusing me. It has the same settings as the old one.

As for the version and repo: I'm on FreeBSD so I have to go with the version available on the ports/packages. I installed it from package just like the old version. The jail (like a VM) is dedicated to ZM and only this installation. Not shared with the old version.

However I now have to break down the problems. I'm putting the motion detection aside for now.
The problem seems to be _not_ that it does not get detected but that it fails to record it.
Therefore can some kind soul see if my configs have errors. Live view and thmbnails work, which I thought were sufficient to confirm zms can create and retrieve data from socks.
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

Re: Help please for a new start with motion detection v 1.36

Post by cookiemonster »

I'm really stumped at the moment, just can't see what is the actual problem. There must be a problem that prevents motion being recorded.
To recap.
- I can see thumbnails in the UI, console section.
- Video can be seen streaming when selecting the camera from the UI.
- When I look at that streamed video and immediately go to the UI log I see errors like:

Code: Select all

getStreamCmdResponse stream error: socket_bind( /var/run/zm/zms-315688w.sock ) failed: Address already in use - checkStreamForErrors()
- The sock file does exist and has www:www permissions on it and its directory albeit without a "w" character in the log:

Code: Select all

root@zoneminder_new:/var/log/zm # ls -alh /var/run/zm/
total 27
drwxr-xr-x  2 www   www      12B Jan  5 20:36 .
drwxr-xr-x  9 root  wheel    22B Jan  5 13:42 ..
-rw-r--r--  1 www   www       5B Jan  5 16:10 zm.pid
srwxr-xr-x  1 www   www       0B Jan  5 16:10 zmdc.sock
-rw-------  1 www   www       0B Jan  5 15:29 zms-004577.lock
-rw-------  1 www   www       0B Jan  5 13:50 zms-047921.lock
-rw-------  1 www   www       0B Jan  5 14:20 zms-220940.lock
-rw-------  1 www   www       0B Jan  5 20:36 zms-315688.lock
-rw-------  1 www   www       0B Jan  5 15:29 zms-377308.lock
-rw-------  1 www   www       0B Jan  5 20:35 zms-502832.lock
-rw-------  1 www   www       0B Jan  5 14:20 zms-748542.lock
-rw-------  1 www   www       0B Jan  5 13:50 zms-929928.lock
- A check from a shell seems to Ok every component, thus:

Code: Select all

root@zoneminder_new:/ # /usr/local/bin/zmdc.pl status
'zmfilter.pl --filter_id=2 --daemon' running since 22/01/05 13:42:47, pid = 6825, valid
'zmfilter.pl --filter_id=3 --daemon' running since 22/01/05 13:42:47, pid = 6829, valid
'zmc -m 1' running since 22/01/05 13:42:46, pid = 6812, valid
'zmtelemetry.pl' running since 22/01/05 13:42:49, pid = 6841, valid
'zmc -m 2' running since 22/01/05 15:29:39, pid = 40746, valid
'zmstats.pl' running since 22/01/05 13:42:49, pid = 6845, valid
'zmupdate.pl -c' running since 22/01/05 13:42:48, pid = 6837, valid
'zmwatch.pl' running since 22/01/05 13:42:48, pid = 6833, valid
'zmfilter.pl --filter_id=1 --daemon' running since 22/01/05 13:42:46, pid = 6821, valid
I've enabled debug logging for all components for about 20 mins & restarted ZM to try and see some clue but I can't see anything jumping at me. I've only grepped for error but I can only see symptoms on web_php.

Some pointers please.
cookiemonster
Posts: 13
Joined: Sat Aug 15, 2015 1:46 pm

[Solved] Help please for a new start with motion detection v 1.36

Post by cookiemonster »

Just to close this as resolved.
Following the advice on another thread, I had to blow this installation and create a new freebsd jail to build ZM 1.36.12 from ports.
This version 1.36.5 available from binary package just does not work for me with the issues mentioned.
pimehexon
Posts: 7
Joined: Wed Jan 12, 2022 2:55 pm

Re: Help please for a new start with motion detection v 1.36

Post by pimehexon »

Can you give the link to the thread that helped you to find the solution?
Post Reply