Page 2 of 2

Posted: Wed Oct 18, 2006 2:45 pm
by svadu
Ah right:

Code: Select all

10/18/06 15:49:49.137645 zmdc[27853].INF ['zmc -m 1' started at 06/10/18 15:49:49]
10/18/06 15:49:49.180849 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:49:49, pid = 27853]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:49:49.465609 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:49:49.467578 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:49:49.472731 zmdc[27855].INF ['zmc -m 1' started at 06/10/18 15:49:49]
10/18/06 15:49:49.489099 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:49:49, pid = 27855]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:49:49.752049 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:49:54.053440 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:49:54.058727 zmdc[27858].INF ['zmc -m 1' started at 06/10/18 15:49:54]
10/18/06 15:49:54.063330 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:49:54, pid = 27858]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:49:54.337711 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:50:04.038427 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:50:04.044380 zmdc[27860].INF ['zmc -m 1' started at 06/10/18 15:50:04]
10/18/06 15:50:04.091155 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:50:04, pid = 27860]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:50:04.321081 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:50:24.022436 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:50:24.027750 zmdc[27862].INF ['zmc -m 1' started at 06/10/18 15:50:24]
10/18/06 15:50:24.047103 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:50:24, pid = 27862]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:50:24.304929 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:51:04.006431 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:51:04.011705 zmdc[27867].INF ['zmc -m 1' started at 06/10/18 15:51:04]
10/18/06 15:51:04.018046 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:51:04, pid = 27867]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:51:04.289468 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:52:04.090431 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:52:04.096961 zmdc[27872].INF ['zmc -m 1' started at 06/10/18 15:52:04]
10/18/06 15:52:04.134832 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:52:04, pid = 27872]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:52:04.375503 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:53:04.076432 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:53:04.081781 zmdc[27877].INF ['zmc -m 1' started at 06/10/18 15:53:04]
10/18/06 15:53:04.126093 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:53:04, pid = 27877]
Not a JPEG file: starts with 0x43 0x6f
10/18/06 15:53:04.359001 zmdc[27368].ERR ['zmc -m 1' exited abnormally, exit status 1]
10/18/06 15:54:04.077433 zmdc[27368].INF [Starting pending process, zmc -m 1]
10/18/06 15:54:04.082351 zmdc[27368].INF ['zmc -m 1' starting at 06/10/18 15:54:04, pid = 27882]
10/18/06 15:54:04.086281 zmdc[27882].INF ['zmc -m 1' started at 06/10/18 15:54:04]

Posted: Wed Oct 18, 2006 3:05 pm
by svadu
Looks like 0x43 0x6f is 'Co' it occurs in the following cases:

* Content-Type
* Content-Length
* Content-Auth

Posted: Wed Oct 18, 2006 3:45 pm
by zoneminder
I think your modified regexp is changing the header match from "boundary to double line endings" to "boundary to two lines terminated with line endings" so it is stopping after the second header line.

Consequently your next header is being included in the image content. One out and out hack you could do to get round this is on the buffer.Consume( subheader_len ) line below. If your extra headers are a fixed length always then just add that length, including any line end chars, to the subheader_len consumed, e.g. buffer.Consume( subheader_len + 37 )

That _might_ work.

Posted: Wed Oct 18, 2006 6:46 pm
by svadu
Ok, I see the probem now, the old regexpr was counting on presense of empty line as the end of subheader. The new regexpr is only getting 2 lines of subheader...

Posted: Wed Oct 18, 2006 7:15 pm
by svadu
It looks like a bug in the jpeg subheaders of the camera, they miss obligatory extra \r\n...

http://www.axis.com/techsup/cam_servers ... tp_api.htm

Posted: Wed Oct 18, 2006 11:18 pm
by svadu
Ok, I've came up with a good regexp:

Code: Select all

^((?:\r?\n){0,2}?(?:--)?%s\r?\n.+?\r?\n(?:Content.+?\r?\n){0,3}(?:\r?\n)?)
It's based on fact that there must be upto 3 headers that all start with 'Content' and it also tries to make the last empty line optional (workaroudn for non-compliant E-tech). This works very well for my E-Tech Wi-Fi camera (I am getting a mjpeg stream with it right now), unfortunately since I don't have a camera compliant with mjpeg stream so I can't test the empty line at the end of the header.

If somebody could test it - that would be great! Another potential problem is that the 'Content' is case sensitive, I hope all cameras follow the case sensitivity as it's specified in the standard, if not then the RegExpr shoudl be changed from DAT_ALL (or whatever it is) to case insensitive.

Posted: Thu Oct 19, 2006 1:06 am
by svadu
I still have strange thing happening - exactly once a minute the 3rd line (and once in the logs I found that both 2nd and 3rd are skipped) of the header get's skipped and and I am getting 'not a jpeg file' complaining about Content-Auth getting in jpeg binary content...
Is there anything in thr system that might be happening every minute?
I dont see how this can be happening unless camera puts another 'suprise' in the stream every minute...

Posted: Fri Oct 20, 2006 9:07 am
by zoneminder
Can you just 'wget' the stream and see if it occurs in there?

Posted: Fri Oct 20, 2006 10:00 pm
by svadu
I'll try to do that at day time. I am more declinign to opinion that the problem is in somethign else because I have situation close to ideal at night time and almost no stable streaming during the day (however my camera is within 10 meters from the router...).