Question about Content-Auth in mjpeg
Question about Content-Auth in mjpeg
Hi All,
Currently, I am unable to read mjpeg from my cam (see post http://www.zoneminder.com/forums/viewtopic.php?t=7028 ). I checked the header of the stream (via wget) and this is what I get:
--myboundary
Content-Type: image/jpeg
Content-Length: 017354
Content-Auth: 0F45323BCA07027
0xFF 0xD8 0xFF (and other jpeg stuff)
Question to those who is more familiar with the source code: will this header be successfully parsed? The reason I am asking is because I don't see handling of Content-Auth header in the code (and I am not familiar with the sources well enough to draw conclusions). Also this post http://www.lavrsen.dk/twiki/bin/view/Mo ... tAuthPatch has cought my attention (hence the reason I amn posting here).
Currently, I am unable to read mjpeg from my cam (see post http://www.zoneminder.com/forums/viewtopic.php?t=7028 ). I checked the header of the stream (via wget) and this is what I get:
--myboundary
Content-Type: image/jpeg
Content-Length: 017354
Content-Auth: 0F45323BCA07027
0xFF 0xD8 0xFF (and other jpeg stuff)
Question to those who is more familiar with the source code: will this header be successfully parsed? The reason I am asking is because I don't see handling of Content-Auth header in the code (and I am not familiar with the sources well enough to draw conclusions). Also this post http://www.lavrsen.dk/twiki/bin/view/Mo ... tAuthPatch has cought my attention (hence the reason I amn posting here).
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Well I though this was a problem because if I enable debug level=4 I get the following deubg output:
I thought it can't parse the header... Strange thing is that WalkGuard plays the stream with no problem... I tried to play the stream with Firefox but instead of getting picture I am getting a string which path to the mjpeg resource (and if I check content type it still shows that it's jpeg) and Firefox contuniously receives the stream (just not displaying it).
Any ideas?
Code: Select all
'HTTP/1.0 200 OK
Cache-Control: no-cache
Content-type: multipart/x-mixed-replace;boundary=--myboundary
']
10/16/06 19:55:16.097391 zmc_m1[19787].DB3-zm_remote_camera.cpp/320 [Got status '200' (OK), http version 1.0]
10/16/06 19:55:16.097694 zmc_m1[19787].DB3-zm_remote_camera.cpp/343 [Got content type 'multipart/x-mixed-replace'
]
10/16/06 19:55:16.097818 zmc_m1[19787].DB3-zm_remote_camera.cpp/347 [Got content boundary '--myboundary']
10/16/06 19:55:16.098015 zmc_m1[19787].DB3-zm_remote_camera.cpp/440 [Unable to extract subheader from stream, retrying]
10/16/06 19:55:16.105681 zmc_m1[19787].DB3-zm_remote_camera.cpp/225 [Expecting 1448 bytes]
10/16/06 19:55:16.105877 zmc_m1[19787].DB3-zm_remote_camera.cpp/250 [Read 1448 bytes]
10/16/06 19:55:16.106618 zmc_m1[19787].DB3-zm_remote_camera.cpp/440 [Unable to extract subheader from stream, retrying]
Any ideas?
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
The unable to parse subheader message is normal, which is why it is just debug. It just means that it has not received enough data to capture and decode the http headers for the image yet, and needs to get more data.
However if that is all you get then something is amiss... Maybe try ZM without regular expressions and see if that makes a difference.
However if that is all you get then something is amiss... Maybe try ZM without regular expressions and see if that makes a difference.
Phil
I tried both http 1.1 with and without regular expressions and http 1.0 with and without regular expressions. All I am getting is black box with 0 fps.
I have these 'Unable to extract subheader from stream, retrying' for 5 minutes without any other messages (untill I interrupted it myself). It looked like this (in the loop for 5 minutes):
Sometimes I am getting this message: "Not a JPEG file: starts with 0x43 0x6f"
I could upload a dump of the stream (got it with wget) if someone can have a 'quick' look... (if it can help)...
I have these 'Unable to extract subheader from stream, retrying' for 5 minutes without any other messages (untill I interrupted it myself). It looked like this (in the loop for 5 minutes):
Code: Select all
10/16/06 19:55:16.098015 zmc_m1[19787].DB3-zm_remote_camera.cpp/440 [Unable to extract subheader from stream, retrying]
10/16/06 19:55:16.105681 zmc_m1[19787].DB3-zm_remote_camera.cpp/225 [Expecting 1448 bytes]
10/16/06 19:55:16.105877 zmc_m1[19787].DB3-zm_remote_camera.cpp/250 [Read 1448 bytes]
I could upload a dump of the stream (got it with wget) if someone can have a 'quick' look... (if it can help)...
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Ok the grabbed video.cgi i slocated at: http://emaps-online.com/temp/video.cgi
And the debug output is located at: http://emaps-online.com/temp/debug1%20-%20broken
Please, let me know if you need more data
Thanks!
Sergei
And the debug output is located at: http://emaps-online.com/temp/debug1%20-%20broken
Please, let me know if you need more data
Thanks!
Sergei
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
I _think_ the problem here is that the cam is not leaving a blank line after the headers but before the image. ZM uses this to detect the end of the subheaders, hence the debug, so it thinks the headers never end.
I'm not quite sure of the best way to address this. I _may_ be able to suggest a patch to ZM to handle this camera but it would be a bespoke fix as it might break other cams.
I'm not quite sure of the best way to address this. I _may_ be able to suggest a patch to ZM to handle this camera but it would be a bespoke fix as it might break other cams.
Phil
Well I tried another which supposed to work with both:
Old code:
New code:
Then I was getting only few messages then a subheader was read. I was still getting black box and 0 fps...
Imho there is something in JPEG itself that zm can not interpret but the active-x and WalkGuard can.
Regards,
Sergei
Old code:
Code: Select all
snprintf( subheader_pattern, sizeof(subheader_pattern), "^((?:\r?\n){0,2}?(?:--)?%s\r?\n.+?\r?\n\r?\n)", content_boundary );
Code: Select all
snprintf( subheader_pattern, sizeof(subheader_pattern), "^((?:\r?\n){0,2}?(?:--)?%s\r?\n.+?\r?\n.+?\r?\n)", content_boundary );
Imho there is something in JPEG itself that zm can not interpret but the active-x and WalkGuard can.
Regards,
Sergei
This is what I was getting with the fix:
That looked normal at least to me.
Code: Select all
'HTTP/1.0 200 OK^M
Cache-Control: no-cache^M
Content-type: multipart/x-mixed-replace;boundary=--myboundary^M
^M
']
10/16/06 22:11:59.374581 zmc_m1[23788].DB3-zm_remote_camera.cpp/320 [Got status '200' (OK), http version 1.0]
10/16/06 22:11:59.374883 zmc_m1[23788].DB3-zm_remote_camera.cpp/343 [Got content type 'multipart/x-mixed-replace'
]
10/16/06 22:11:59.375006 zmc_m1[23788].DB3-zm_remote_camera.cpp/347 [Got content boundary '--myboundary']
10/16/06 22:11:59.375200 zmc_m1[23788].DB3-zm_remote_camera.cpp/441 [Unable to extract subheader from stream, retrying]
10/16/06 22:11:59.386758 zmc_m1[23788].DB3-zm_remote_camera.cpp/225 [Expecting 1448 bytes]
10/16/06 22:11:59.386966 zmc_m1[23788].DB3-zm_remote_camera.cpp/250 [Read 1448 bytes]
10/16/06 22:11:59.387154 zmc_m1[23788].DB4-zm_remote_camera.cpp/418 [Captured subheader (64 bytes):'--myboundary^M
Content-Type: image/jpeg^M
Content-Length: 003185^M
']
10/16/06 22:11:59.387377 zmc_m1[23788].DB3-zm_remote_camera.cpp/425 [Got subcontent length '3185']
10/16/06 22:11:59.387535 zmc_m1[23788].DB3-zm_remote_camera.cpp/433 [Got subcontent type 'image/jpeg']
10/16/06 22:11:59.432728 zmc_m1[23788].DB3-zm_remote_camera.cpp/225 [Expecting 1448 bytes]
10/16/06 22:11:59.432922 zmc_m1[23788].DB3-zm_remote_camera.cpp/250 [Read 1448 bytes]
10/16/06 22:11:59.467979 zmc_m1[23788].DB3-zm_remote_camera.cpp/225 [Expecting 386 bytes]
10/16/06 22:11:59.468174 zmc_m1[23788].DB3-zm_remote_camera.cpp/250 [Read 386 bytes]
10/16/06 22:11:59.468664 zmc_m1[23788].DB3-zm_remote_camera.cpp/480 [Got end of image by length, content-length = 3185]
10/16/06 22:11:59.468786 zmc_m1[23788].DB3-zm_remote_camera.cpp/537 [Returning 3185 (3232) bytes of captured content]
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
OK, here is more complete debug (level 5):
http://emaps-online.com/temp/zm_complete_debug.log
I do not see any complains about the Jpegs.
http://emaps-online.com/temp/zm_complete_debug.log
I do not see any complains about the Jpegs.
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact: