zmc: zm_image.h

Support and queries relating to all previous versions of ZoneMinder
Locked
reve
Posts: 16
Joined: Sun Mar 28, 2004 7:01 pm

zmc: zm_image.h

Post by reve »

Hi

I've got a lot further in the config, sorted out the permissions on the log files, and installed the correct perl modules. Zoneminder starts and stops gracefully from the browser - but I still have no images.

I have 2 monitors defined - one Axis 2420 (Monitor 1) that is next to me...and an Axis 205 (Monitor 2) that is available over the web. Neither produce images. though both work fine directly from the browser (so the cameras are working).

In zmdc.log, I get:

Starting pending process, zmc -m 1
'zmc -m 1' starting at 04/04/02 00:10:21, pid = 1981
'zmc -m 1' started at 04/04/02 00:10:21
zmc: zm_image.h:192: void Image::CopyBuffer(const Image&): Assertion `width == image.width && height == image.height && colours == image.colours' failed.
'zmc -m 1' died at 04/04/02 00:10:22, signal 6
Starting pending process, zmc -m 2
'zmc -m 2' starting at 04/04/02 00:11:07, pid = 1983
'zmc -m 2' started at 04/04/02 00:11:07
zmc: zm_image.h:192: void Image::CopyBuffer(const Image&): Assertion `width == image.width && height == image.height && colours == image.colours' failed.
'zmc -m 2' died at 04/04/02 00:11:18, signal 6

repeated at regular intervals - clearly both monitors are dying. In /var/log/messages I am getting:

Apr 2 00:10:21 pig zmc-m1[1981]: INF [Debug Level = 0, Debug Log = ]
Apr 2 00:10:21 pig zmc-m1[1981]: INF [Starting Capture]
Apr 2 00:10:22 pig zma-m2[1882]: WAR [Waiting for capture daemon]
Apr 2 00:10:53 pig last message repeated 30 times
Apr 2 00:11:06 pig last message repeated 13 times
Apr 2 00:11:07 pig zmc-m2[1983]: INF [Debug Level = 0, Debug Log = ]
Apr 2 00:11:07 pig zmc-m2[1983]: INF [Starting Capture]
Apr 2 00:11:07 pig zma-m2[1882]: WAR [Waiting for capture daemon]
Apr 2 00:11:09 pig last message repeated 2 times
Apr 2 00:11:09 pig zmc-m2[1983]: ERR [Select timed out]
Apr 2 00:11:10 pig zma-m2[1882]: WAR [Waiting for capture daemon]
Apr 2 00:11:11 pig zma-m2[1882]: WAR [Waiting for capture daemon]
Apr 2 00:11:12 pig zmc-m2[1983]: ERR [Select timed out]
Apr 2 00:11:12 pig zma-m2[1882]: WAR [Waiting for capture daemon]
Apr 2 00:11:43 pig last message repeated 31 times
Apr 2 00:12:44 pig last message repeated 60 times
Apr 2 00:13:02 pig last message repeated 18 times
Apr 2 00:13:02 pig zmc-m1[1999]: INF [Debug Level = 0, Debug Log = ]
Apr 2 00:13:02 pig zmc-m1[1999]: INF [Starting Capture]
Apr 2 00:13:03 pig zma-m2[1882]: WAR [Waiting for capture daemon]

Shutting the whole thing down, and then running strace zmc -m1 gives me:

rt_sigaction(SIGPIPE, {0x420e02d0, [], SA_RESTORER, 0x42028518}, {SIG_IGN}, 8) = 0
send(3, "<142>Apr 2 00:14:27 zmc-m1[2050"..., 57, 0) = 57
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
rt_sigaction(SIGTERM, {0x8049f40, [], SA_RESTORER, 0x42028518}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [USR1 USR2], NULL, 8) = 0
gettimeofday({1080861267, 586475}, {4294967236, 0}) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 5
connect(5, {sin_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.51")}}, 16) = 0
write(5, "GET /cgi-bin/mjpg/video.cgi?reso"..., 129) = 129
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {1, 930000})
ioctl(5, 0x541b, [130]) = 0
read(5, "HTTP/1.0 200 OK\r\nConnection: Clo"..., 130) = 130
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {2, 10000})
ioctl(5, 0x541b, [1460]) = 0
read(5, "Content-Type: image/jpeg\r\n\r\n\377\330\377\376"..., 1460) = 1460
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {2, 10000})
ioctl(5, 0x541b, [1460]) = 0
read(5, "{8\356R`\221\264s\t\25\232H\366ny\2\312\3406\360\0\21\360"..., 1460) = 1460
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {2, 10000})
ioctl(5, 0x541b, [1460]) = 0
read(5, "\324$\324\357\324\324&\200\33I\236\264\264b\200\22\242"..., 1460) = 1460
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {2, 10000})
ioctl(5, 0x541b, [2920]) = 0
read(5, "\351R&\220\276w\225qx\305\311\3l1\36>\254\177\302\266#"..., 2920) = 2920
select(6, [5], NULL, NULL, {2, 500}) = 1 (in [5], left {2, 10000})
ioctl(5, 0x541b, [3181]) = 0
read(5, "\0 \346\200&\16=sU\f\233d\220}\241\343\314\207\345T\316"..., 3181) = 3181
brk(0) = 0xc8fb000
brk(0xc8fc000) = 0xc8fc000
mmap2(NULL, 307200, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x403a5000
gettimeofday({1080861267, 677699}, {4294967236, 0}) = 0
write(2, "zmc: zm_image.h:192: void Image:"..., 154zmc: zm_image.h:192: void Image::CopyBuffer(const Image&): Assertion `width == image.width && height == image.height && colours == image.colours' failed.
) = 154
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
getpid() = 2050
kill(2050, SIGABRT) = 0
--- SIGABRT (Aborted) ---
+++ killed by SIGABRT +++
[root@pig bin]#

(I've only included the last few lines).

As ever, ideas and suggestions are gratefully received...

Thanks

Rupert Eve
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: zmc: zm_image.h

Post by zoneminder »

Hi Rupert,

I suspect this is because the URL you have entered for your image source is returning images of a different size than your monitor is configured for. That's the first thing to check anyway.

Phil,
reve
Posts: 16
Joined: Sun Mar 28, 2004 7:01 pm

Re: zmc: zm_image.h

Post by reve »

Thanks Phil - got the problem. The image was the right size - but both of the cameras add timestamps to the image, which makes it bigger. Once I disabled the timestamp on the 2420....the error goes away. I now have a bunch of "shmget permission denied" - but there is enough of that on the forums already to provide a fix.

Thanks again

Rupert
reve
Posts: 16
Joined: Sun Mar 28, 2004 7:01 pm

Re: zmc: zm_image.h

Post by reve »

Phil

Sorry - but I'm back! It wasn't actually the timestamp alone - my camera outputs B/W - but ZM does not appear to like the images when set to 8 bit B/W. If I set to 24 bit colour, I get some action (i.e. a picture - at last) - but a truck load of errors in the syslog and zmdc.log.

Here is syslog:

Apr 4 13:14:11 pig zmc-m1[16045]: INF [Debug Level = 0, Debug Log = ]
Apr 4 13:14:11 pig zmc-m1[16045]: INF [Starting Capture]
Apr 4 13:14:11 pig zmc-m1[16045]: WAR [Buffer overrun at index 0 ]
Apr 4 13:14:42 pig last message repeated 143 times
Apr 4 13:15:43 pig last message repeated 291 times
Apr 4 13:15:47 pig last message repeated 20 times
Apr 4 13:15:51 pig zmc-m1[16057]: INF [Debug Level = 0, Debug Log = ]
Apr 4 13:15:51 pig zmc-m1[16057]: INF [Starting Capture]
Apr 4 13:15:52 pig zmc-m1[16057]: WAR [Buffer overrun at index 0 ]
Apr 4 13:16:23 pig last message repeated 148 times
Apr 4 13:17:24 pig last message repeated 290 times
Apr 4 13:17:49 pig last message repeated 122 times
Apr 4 13:17:52 pig zmc-m1[16061]: INF [Debug Level = 0, Debug Log = ]
Apr 4 13:17:52 pig zmc-m1[16061]: INF [Starting Capture]
Apr 4 13:17:52 pig zmc-m1[16061]: WAR [Buffer overrun at index 0 ]
Apr 4 13:18:23 pig last message repeated 145 times
Apr 4 13:19:24 pig last message repeated 290 times
Apr 4 13:19:24 pig last message repeated 4 times
Apr 4 13:19:32 pig zmc-m1[16075]: INF [Debug Level = 0, Debug Log = ]
Apr 4 13:19:32 pig zmc-m1[16075]: INF [Starting Capture]
Apr 4 13:19:32 pig zmc-m1[16075]: WAR [Buffer overrun at index 0 ]
Apr 4 13:20:03 pig last message repeated 145 times
Apr 4 13:20:33 pig last message repeated 144 times
Apr 4 13:20:42 pig zmc-m1[16075]: INF [Got TERM signal, exiting]
Apr 4 13:20:59 pig zmc-m1[16081]: INF [Debug Level = 0, Debug Log = ]
Apr 4 13:20:59 pig zmc-m1[16081]: INF [Starting Capture]
Apr 4 13:20:59 pig zmc-m1[16081]: WAR [Buffer overrun at index 0 ]
Apr 4 13:21:30 pig last message repeated 146 times
Apr 4 13:22:31 pig last message repeated 285 times
Apr 4 13:23:32 pig last message repeated 286 times
Apr 4 13:24:33 pig last message repeated 218 times

And here is a chunk of zmdc.log:

'zmc -m 1' starting at 04/04/04 12:59:10, pid = 15608
'zmc -m 1' started at 04/04/04 12:59:10
Corrupt JPEG data: 464 extraneous bytes before marker 0xd9
Corrupt JPEG data: 464 extraneous bytes before marker 0xd9
Corrupt JPEG data: 464 extraneous bytes before marker 0xd9
Corrupt JPEG data: 782 extraneous bytes before marker 0xd9
Corrupt JPEG data: 943 extraneous bytes before marker 0xd9
Corrupt JPEG data: 943 extraneous bytes before marker 0xd9
Corrupt JPEG data: 1040 extraneous bytes before marker 0xd9
Corrupt JPEG data: 643 extraneous bytes before marker 0xd9
Corrupt JPEG data: 6 extraneous bytes before marker 0xc4
Corrupt JPEG data: 6 extraneous bytes before marker 0xc4
Corrupt JPEG data: 719 extraneous bytes before marker 0xd9
Corrupt JPEG data: 164 extraneous bytes before marker 0xc4
Invalid JPEG file structure: SOS before SOF
'zmc -m 1' crashed at 04/04/04 12:59:30, exit status 1
Starting pending process, zmc -m 1
'zmc -m 1' starting at 04/04/04 12:59:35, pid = 15641
'zmc -m 1' started at 04/04/04 12:59:35
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: 34 extraneous bytes before marker 0xd9
Corrupt JPEG data: 34 extraneous bytes before marker 0xd9
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment

I am guesing, but I would assume that my camera (a 2420) is doing something weird with the images.

Any ideas? If you need more info, just let me know what to run, and I'll send you the results...

Thx

Rupert
reve
Posts: 16
Joined: Sun Mar 28, 2004 7:01 pm

Re: zmc: zm_image.h

Post by reve »

OK - got some updates.

1) Restarting the machine seems to have got rid of the Corrupt JPEG data messages. The 2420 is a 24 bit camera - so it is not surprising the ZM is happier with 24 bit selected!

2) If I configure the monitor as "monitor", then I get no errors in the syslog, the stills view works, but the streaming doesn't. (Haven't installed Cambozola yet, so this is probably why.

3) If I set the monitor to "Modetect" I get buffer overruns reported in syslog:

Apr 4 19:12:06 pig zms[19738]: INF [Debug Level = 0, Debug Log = ]
Apr 4 19:12:26 pig zms[19769]: INF [Debug Level = 0, Debug Log = ]
Apr 4 19:13:34 pig zmc-m1[19647]: INF [Axis2400: 1000 - Capturing at 7.69 fps]
Apr 4 19:15:44 pig zmc-m1[19647]: INF [Axis2400: 2000 - Capturing at 7.69 fps]
Apr 4 19:16:30 pig zmc-m1[19647]: INF [Got TERM signal, exiting]
Apr 4 19:16:30 pig zmc-m1[20129]: INF [Debug Level = 0, Debug Log = ]
Apr 4 19:16:30 pig zmc-m1[20129]: INF [Starting Capture]
Apr 4 19:16:31 pig zma-m1[20137]: INF [Debug Level = 0, Debug Log = ]
Apr 4 19:16:31 pig zma-m1[20137]: INF [Warming up]
Apr 4 19:16:31 pig zmc-m1[20129]: WAR [Buffer overrun at index 0 ]
Apr 4 19:17:02 pig last message repeated 227 times
Apr 4 19:18:03 pig last message repeated 461 times
Apr 4 19:18:40 pig last message repeated 306 times
Apr 4 19:18:40 pig zmc-m1[20129]: INF [Axis2400: 1000 - Capturing at 7.69 fps]
Apr 4 19:18:40 pig zmc-m1[20129]: WAR [Buffer overrun at index 0 ]
Apr 4 19:19:11 pig last message repeated 237 times
Apr 4 19:20:12 pig last message repeated 502 times
Apr 4 19:20:20 pig last message repeated 68 times
Apr 4 19:20:20 pig zmc-m1[20129]: INF [Got TERM signal, exiting]
Apr 4 19:20:20 pig zmc-m1[20129]: ERR [Select error: Interrupted system call]
Apr 4 19:20:20 pig zmc-m1[20290]: INF [Debug Level = 0, Debug Log = ]
Apr 4 19:20:20 pig zmc-m1[20290]: INF [Starting Capture]
Apr 4 19:20:20 pig zmc-m1[20290]: WAR [Buffer overrun at index 0 ]
Apr 4 19:20:51 pig last message repeated 252 times
Apr 4 19:21:52 pig last message repeated 504 times
Apr 4 19:22:21 pig last message repeated 242 times
Apr 4 19:22:21 pig zmc-m1[20290]: INF [Axis2400: 1000 - Capturing at 8.26 fps]
Apr 4 19:22:21 pig zmc-m1[20290]: WAR [Buffer overrun at index 0 ]

Note that the section of syslog where there are two adjacent "Capturing" messages was where I had "Monitor" enabled. As soon as I switched to modetect...the overruns started. I assume this is why motion detection is not working?

Thanks

Rupert
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: zmc: zm_image.h

Post by zoneminder »

Hi Rupert,

The buffer overrun messages result from when the capture daemon detects that it is writing on top of images in the ring buffer that have not been read. This almost certainly always occurs when the zma (analysis) daemon starts and then crashes as the initial setting of the read counter prevents this from happening. I would suggest a couple of things. Firstly perhaps try shutting down zm and then running 'zmc -m 1' from the command line and then 'zma -m 1' from the gdb debugger and see if that causes anything to leap out. If you need any help with this let me know. Alternatively we can try it with debug on and see what that does if this does not work.

Cheers,

Phil,
reve
Posts: 16
Joined: Sun Mar 28, 2004 7:01 pm

Re: zmc: zm_image.h

Post by reve »

Phil

Thanks very much for your help - your explanation got me thinking - and I had reduced the frame buffer size to 1 during some earlier shmget fun and games. Unsurprisingly it was being overwritten as soon as it arrived. Increasing this to 20 gives me motion detection, the lot - and no errors! Thanks very much - and you can add an Axis 2420, Rev 2.34 to the compatability list. zmc is chewing 90% of an Athlon 2200+ - but I've probably used some daft settings during testing...

Thanks again

Rupert
Locked