Event image numbering

Support and queries relating to all previous versions of ZoneMinder
Locked
zaius
Posts: 5
Joined: Thu Aug 05, 2004 12:37 pm

Event image numbering

Post by zaius »

Hi, I'm having difficulty with ZM 1.19.4 and events.
I record some long events and so I have set ZM_EVENT_IMAGE_DIGITS to 4. When I view an event, it stops after a few frames. I changed to the stills view and noticed that some stills were missing from the view. I traced this back to the numbering of some of the event images.
Some images (generally near the start of the stream) are correctly recorded with 4 digits but the remaining are recorded with 3. The event view is trying to access the images with 4 digits of significance and so doesn't display the images with 3. Here is an example listing from one of the directories:

0003-capture.jpg
0004-capture.jpg
0005-capture.jpg
0006-capture.jpg
0007-capture.jpg
0008-capture.jpg
0009-capture.jpg
0010-capture.jpg
0011-capture.jpg
001-capture.jpg
002-capture.jpg
012-capture.jpg
013-capture.jpg
014-capture.jpg
015-capture.jpg
016-capture.jpg
017-capture.jpg
018-capture.jpg
019-capture.jpg
020-capture.jpg
and so on up to 999-capture. From there, the images are in the thousands where 4 digits of significance are required and so are numbered correctly.

The only other nondefault entry I have is ZM_OPT_FRAME_SERVER = true.
Has anyone else run into a similar problem? Am I doing something completely wrong?
David
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Hi,

Looks like you've found a bug there! The zmf daemon doesn't check the number of digits.

So you've two options. One, turn off zmf or two, apply the patch below. I admit I've not had chance to test it but it compiles so it's bound to work! The patch should work for 1.19.4 and 1.19.5.

Let me know how you get on.

Phil,

Code: Select all

*** zmf.cpp     7 Sep 2004 08:45:00 -0000       1.10
--- zmf.cpp     7 Oct 2004 15:17:19 -0000
***************
*** 203,208 ****
--- 203,213 ----
                exit( -1 );
        }
  
+       char capt_path[PATH_MAX];
+       char anal_path[PATH_MAX];
+       snprintf( capt_path, sizeof(capt_path), "%s/%d/%%d/%%0%dd-capture.jpg", (const char *)config.Item( ZM_DIR_EVENTS ), monitor->Id(), (int)config.Item( ZM_EVENT_IMAGE_DIGITS ) );
+       snprintf( anal_path, sizeof(anal_path), "%s/%d/%%d/%%0%dd-analyse.jpg", (const char *)config.Item( ZM_DIR_EVENTS ), monitor->Id(), (int)config.Item( ZM_EVENT_IMAGE_DIGITS ) );
+ 
        sigset_t block_set;
        sigemptyset( &block_set );
        struct sigaction action, old_action;
***************
*** 288,294 ****
                        continue;
                }
                static char path[PATH_MAX] = "";
!               snprintf( path, sizeof(path), "%s/%d/%ld/%03ld-%s.jpg", (const char *)config.Item( ZM_DIR_EVENTS ), monitor->Id(), frame_header.event_id, frame_header.frame_id, frame_header.alarm_frame?"analyse":"capture" );
                Debug( 1, ( "Got image, writing to %s", path ));
  
                FILE *fd = 0;
--- 293,299 ----
                        continue;
                }
                static char path[PATH_MAX] = "";
!               snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, "%s/%d/%ld/%03ld-%s.jpg", frame_header.event_id, frame_header.frame_id );
                Debug( 1, ( "Got image, writing to %s", path ));
  
                FILE *fd = 0;
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Ack! Ignore that, the patch will only work for 1.19.5. I'll try and get a 1.19.4 done as soon as I get chance.

Phiol,
User avatar
fernando
Posts: 240
Joined: Thu Jul 10, 2003 6:00 pm

Post by fernando »

how is this error is replicated? since i dont find it, ver 1.19.5
i have 5 digit on all the events.
Fernando
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

It will only occur if you have ZM_OPT_FRAME_SERVER on as that uses zmf to write some (or all) of the images to disk and that didn't number them correctly.

Phil,
Locked