Corrupt JPEG data: premature end of data segment

Support and queries relating to all previous versions of ZoneMinder
Locked
PPa
Posts: 3
Joined: Mon Jun 07, 2004 4:17 am

Corrupt JPEG data: premature end of data segment

Post by PPa »

Great program and previous versions have been working just ok. When I did fresh install on Suse 9.1 I got some problems (installation went ok).

I have few axis 2110 network cameras, which do work fine on their own. When I configure them as remote monitors to ZM, I got following problem:

--START--
'zmc -m 3' started at 04/06/07 07:11:31
'zmc -m 3' starting at 04/06/07 07:11:31, pid = 17431
Corrupt JPEG data: premature end of data segment
Invalid JPEG file structure: two SOI markers
'zmc -m 3' crashed at 04/06/07 07:11:32, exit status 1
Use of uninitialized value in hash element at /usr/local/bin/zmdc.pl line 332, <CLIENT> line 1.
'zmc -m 3' started at 04/06/07 07:11:41
'zmc -m 3' starting at 04/06/07 07:11:41, pid = 17451
'zmc -m 3' stopping at 04/06/07 07:12:09
'zmc -m 3' died at 04/06/07 07:12:09
'zmc -m 3' starting at 04/06/07 07:12:09, pid = 17495
'zmc -m 3' started at 04/06/07 07:12:09
Can't find process with command of 'zma -m 3'
Corrupt JPEG data: premature end of data segment
Invalid JPEG file structure: two SOI markers
'zmc -m 3' crashed at 04/06/07 07:12:19, exit status 1
'zmc -m 3' started at 04/06/07 07:12:19
'zmc -m 3' starting at 04/06/07 07:12:19, pid = 17521
Corrupt JPEG data: premature end of data segment
Invalid JPEG file structure: two SOI markers
'zmc -m 3' crashed at 04/06/07 07:12:55, exit status 1
Starting pending process, zmc -m 3
'zmc -m 3' starting at 04/06/07 07:13:00, pid = 17592
'zmc -m 3' started at 04/06/07 07:13:00
Corrupt JPEG data: premature end of data segment
Invalid JPEG file structure: two SOI markers
--END--

This is strange, it will run fine little while and then it crashes.

Any ideas ?
wizdude
Posts: 3
Joined: Mon Jun 07, 2004 8:07 pm

Post by wizdude »

i have the same camera running with a hand made build of zoneminder 1.19.4 running under slackware 9.1 and get precisely the same problem.

now that i've got a clean build of zoneminder running, i'm keep to chase down and remove any final bugs.

my server is dedicated to zoneminder and is a Pentium 3, 1000MHz with 512MB of RAM and 80GB HDD.

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

Post by zoneminder »

These errors are nearly always due to (a) the camera is sending the images in an irregular or inconsistent format, ie the line endings are not correct or (b) chunks of the images are getting lost in transit.

It should be possible to work out which by doing a 'wget -s' to the URL that you use in ZM for the camera. If you save the output to a file and post it here I'll take a look, you might need to remove chunks of the binary parts so it's not too large though.

Phil,
wizdude
Posts: 3
Joined: Mon Jun 07, 2004 8:07 pm

Post by wizdude »

i was reading another thread which spoke about using a different URL with the AXIS cameras to use motion jpeg instead of a jpeg picture in order to bring the frame rate up. it was in fact correct - when i use the URL

/axis-cgi/jpg/image.cgi?resolution=352x288
i get around 4-5fps

/axis-cgi/mjpg/video.cgi?resolution=352x288
gives me 25 fps

... BUT it gives me HEAPS of:

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: 98 extraneous bytes before marker 0xd9
Corrupt JPEG data: 98 extraneous bytes before marker 0xd9

i can't post/send anything from this stream because it streams, but i'll send you some of the static snaps.

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

Post by zoneminder »

Just let it run for a few seconds and then interrupt it, it should still show something sensible if you redirect it into a file.
PPa
Posts: 3
Joined: Mon Jun 07, 2004 4:17 am

Post by PPa »

Sinlge image request with wget:

wget -S http://10.10.74.119/axis-cgi/jpg/image.cgi

--03:30:31-- http://10.10.74.119/axis-cgi/jpg/image.cgi
=> `image.cgi.5'
Connecting to 10.10.74.119:80... connected.
HTTP request sent, awaiting response...
1 HTTP/1.0 200 OK
2 Connection: Close
3 Server: Camd
4 Content-Type: image/jpeg

[ <=> ] 94,713 --.--K/s

03:30:32 (2.59 MB/s) - `image.cgi.5' saved [94713]

Note, this WGET runs totaly ok even in the script loop, where I can get multiple snapshots requested in series. And I think our network (switched 100MB ethernet) is more than ok. I also updated Axis cameras to new, now they have 2.40 software version, because I know old one hung in i/o-line request.

I will examine how to put this video feed in here, or maybe I could send it to you via email - so you can take a look?

OFFTOPIC: I have also wondered how I could wget this video stream from axis and convert it to mpeg etc. I know that every image is divided inside the stream with dedicated '--myboundary' text in the stream. Maybe I just have to examine how to 'grep' images out of the stream.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Hi,

It's the headers I'm more interested in, I see you did a 'wget -S' rather than a 'wget -s', the latter form will store the headers in the file also which is what is important.

Phil,
PPa
Posts: 3
Joined: Mon Jun 07, 2004 4:17 am

Post by PPa »

zoneminder wrote:Hi,

It's the headers I'm more interested in, I see you did a 'wget -S' rather than a 'wget -s', the latter form will store the headers in the file also which is what is important.

Phil,
Does this help:

--CUT --

wget -s http://1.2.74.119/axis-cgi/jpg/image.cgi
--12:39:27-- http://1.2.74.119/axis-cgi/jpg/image.cgi
=> `image.cgi.14'
Connecting to 1.2.74.119:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [image/jpeg]

[ <=> ] 74,481 --.--K/s

12:39:27 (2.37 MB/s) - `image.cgi.14' saved [74481]

more image.cgi.14
HTTP/1.0 200 OK
Connection: Close
Server: Camd
Content-Type: image/jpeg

?(h @dv@?tJ
l%6??C?C?@!?

?}!1AQa"q#B?R?$3br
??%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz???????
????????????

?w!1AQaq"B?#3R?br?
$4????&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
??????????????????^L?'eO~?'xG<???
---CUT---

AND hex dump:
--CUT
hexdump image.cgi.14|more
0000000 5448 5054 312f 302e 3220 3030 4f20 0a4b
0000010 6f43 6e6e 6365 6974 6e6f 203a 6c43 736f
0000020 0a65 6553 7672 7265 203a 6143 646d 430a
0000030 6e6f 6574 746e 542d 7079 3a65 6920 616d
0000040 6567 6a2f 6570 0a67 ff0a ffd8 00fe 6828
0000050 0009 0000 0000 8c40 ac64 4076 b3c5 9174
0000060 808f 0280 0000 0095 0000 004a 6c0a 1001
0000070 250f 1a36 ff1f 00db 0043 0101 0101 0101
0000080 0101 0101 0101 0101 0101 0101 0101 0101
*
00000b0 0101 0101 0101 0101 0101 dbff 4300 0101
00000c0 0101 0101 0101 0101 0101 0101 0101 0101
*
00000f0 0101 0101 0101 0101 0101 0101 0101 ff01
0000100 00c0 0811 f000 4001 0103 0021 1102 0301
0000110 0111 c4ff 1f00 0000 0501 0101 0101 0101
0000120 0000 0000 0000 0000 0201 0403 0605 0807
0000130 0a09 ff0b 00c4 10b5 0200 0301 0203 0304
0000140 0505 0404 0000 7d01 0201 0003 1104 1205
0000150 3121 0641 5113 0761 7122 3214 9181 08a1
0000160 4223 c1b1 5215 f0d1 3324 7262 0982 160a
0000170 1817 1a19 2625 2827 2a29 3534 3736 3938
0000180 433a 4544 4746 4948 534a 5554 5756 5958
0000190 635a 6564 6766 6968 736a 7574 7776 7978
00001a0 837a 8584 8786 8988 928a 9493 9695 9897
00001b0 9a99 a3a2 a5a4 a7a6 a9a8 b2aa b4b3 b6b5
00001c0 b8b7 bab9 c3c2 c5c4 c7c6 c9c8 d2ca d4d3
00001d0 d6d5 d8d7 dad9 e2e1 e4e3 e6e5 e8e7 eae9
00001e0 f2f1 f4f3 f6f5 f8f7 faf9 c4ff 1f00 0001
00001f0 0103 0101 0101 0101 0101 0000 0000 0000
0000200 0201 0403 0605 0807 0a09 ff0b 00c4 11b5
0000210 0200 0201 0404 0403 0507 0404 0100 7702
0000220 0100 0302 0411 2105 0631 4112 0751 7161
0000230 2213 8132 1408 9142 b1a1 09c1 3323 f052
0000240 6215 d172 160a 3424 25e1 17f1 1918 261a
0000250 2827 2a29 3635 3837 3a39 4443 4645 4847
0000260 4a49 5453 5655 5857 5a59 6463 6665 6867
0000270 6a69 7473 7675 7877 7a79 8382 8584 8786
0000280 8988 928a 9493 9695 9897 9a99 a3a2 a5a4
0000290 a7a6 a9a8 b2aa b4b3 b6b5 b8b7 bab9 c3c2
00002a0 c5c4 c7c6 c9c8 d2ca d4d3 d6d5 d8d7 dad9
00002b0 e3e2 e5e4 e7e6 e9e8 f2ea f4f3 f6f5 f8f7
00002c0 faf9 daff 0c00 0103 0200 0311 0011 003f
00002d0 27fe 65bf 824f 137e bdf8 bfe2 1e89 f827
00002e0 a8a9 8378 f847 fb19 fc3c f11f c787 8edf
00002f0 afba ae84 cbf4 163f f85c 414f fcd4 e033
0000300 875f 0e9f 31bc 7f7d f8a3 4faa f80f f683
0000310 f883 f1f9 e013 ecdf a2df 44fc c083 107f
0000320 cfb4 ba83 c59f 5f3b 1e8f f83e e26b 853f
0000330 033e fdf1 f488 8b0f b01f 00ff 3c8b f107
0000340 f617 f0c7 00ff 3c84 e177 00ff 7c19 fd3d
0000350 3e96 fc0f fd3a 34a7 883f ce9a a99b 3ff8
0000360 f852 fbe1 7c2c f871 fba7 7831 f633 f86f
0000370 e1ad 031f 1f5b 5c17 3ff8 1fc4 fc17 fb17
0000380 7c5a f814 73c5 bff0 bac7 91e6 2fe2 de87
0000390 d512 557c 5fe1 df1b 7cdb f050 fee4 ba09
00003a0 f400 630d 02f6 bcd4 f025 e21f 880f 4dbc
00003b0 afe2 b70f 1bc6 8c4f f01f 4f49 fc0c db3d
00003c0 13f1 5ec2 f80d bf2c bf0e a4e0 b1df ed6f
00003d0 fb35 e958 3f17 fc12 f167 4b4f 46f0 e095
00003e0 10ef 3b78 f049 c237 1f3d 3ec4 d72e 61fc
00003f0 cfe1 be85 b802 e29f debc d721 413c 58e1
0000400 2f74 1688 3f7f 7dfc 98fd f867 e125 873f
0000410 137f 297c b7f1 ffe0 ed00 f01b e27b 8867

--CUT

Does this help or shall I mail you few samples ?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes, probably easier to either mail me a few samples (tarred and or zipped please) or mail me the details of the cameras if they are accessible and then I can run some tests on them from here.

Phil,
User avatar
l8nite4me
Posts: 36
Joined: Sun May 09, 2004 4:29 am
Location: US Alabama

My solution to corrupt jpeg data

Post by l8nite4me »

I don't know if this is the case or not, but I would receive these errors every once in a while. It seems to happen when my network was real congested i.e. morning logins, lunch time surfing, end of day file syncs or the camera has been up for several days. I am running some of the cheaper netcams, so this may not be your issue. I have put a sniffer on the wire and what it shows is the cameras are basically out of sync with the server request. Sometimes sending data that is dropped by the server due to malformed address headers.

The easiest solution I have found is running a cron job that reboots the cameras every 12 hours. I have not seen this issue in about 2 weeks now.

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

Post by zoneminder »

I have been working on this with Pasi this week and think I've found a circumstance that causes it. I've sent him a couple of patches to try out and I'm waiting for him to get back to me about the last one which I'm hopefull about.

Phil,
jellono
Posts: 1
Joined: Tue Jul 12, 2011 6:58 pm

Re:

Post by jellono »

zoneminder wrote:I have been working on this with Pasi this week and think I've found a circumstance that causes it. I've sent him a couple of patches to try out and I'm waiting for him to get back to me about the last one which I'm hopefull about.

Phil,

Did this get fixed? And how??


dave
Locked