ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130'

Forum for questions and support relating to the 1.25.x releases only.
Locked
marcmerlin
Posts: 93
Joined: Thu Jan 17, 2013 6:13 pm

ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130'

Post by marcmerlin »

I upgraded my aircam to firmware 1.2 which includes support for snapshot downloads (finally). I know it does RTSP, but I haven't had very good results with that, so I'm switching to snapshots.

http://aircam1/snapshot.cgi gives me jpegs I can see in a browser, or a picture viewer if I download with wget, but if I feed that into ZM, it complains about them.

But, when I feed this to zoneminder, it says:
Oct 16 08:31:42 gargamel zmc_m2[28429]: INF [Starting Capture]
Oct 16 08:31:45 gargamel zmc_m2[28429]: WAR [Select timed out]
Oct 16 08:31:45 gargamel zmc_m2[28429]: ERR [Found bogus jpeg header '3130']
Oct 16 08:31:45 gargamel zmc_m2[28429]: ERR [Unable to get response]
Oct 16 08:31:45 gargamel zmc_m2[28429]: ERR [Failed to capture image from monitor 2 (0/1)

Source tab says:
protocol: http
method: simple
hostname: localhost
port: 80
path: /snapshot.cgi
etc...

links -dump http://aircam1/snapshot.cgi?chan=1 | od -cx
gives:
0000000 y O / y ` a . . J F I F .
2020 7920 2f4f 6079 2e61 4a2e 4946 2e46
0000020 . . . . . . . . . y U . C . . .
2e2e 2e2e 2e2e 2e2e 792e 2e55 2e43 2e2e
0000040 . . . . . . . . . . . . . .

Any idea why ZM is unhappy with those pictures?
marcmerlin
Posts: 93
Joined: Thu Jan 17, 2013 6:13 pm

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by marcmerlin »

If no one has had
Found bogus jpeg header '3130'
before, I can plea to someone with an aircam to see if they can get zoneminder to accept its pictures

For me, http://aircam/snapshot.cgi looks great, but zoneminder just can't grok it :(

Getting the picture from telnet seems to show correct data:
GET /snapshot.cgi HTTP/1.0

HTTP/1.0 200 OK
Set-Cookie: AIROS_SESSIONID=648e31fa826360009e42a87a94eee99f; Path=/; Version=1
Content-Type: image/jpeg
Content-Length: 39772
Connection: close
Date: Sun, 09 Jun 2013 01:18:26 GMT
Server: lighttpd/1.4.31

^@^PJFIF^@^A^A^@^@^A^@^A^@^@^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
(...)
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by mastertheknife »

In ZM options, switch from http/1.1 to http/1.0 and see if that helps.
Kfir Itzhak.
marcmerlin
Posts: 93
Joined: Thu Jan 17, 2013 6:13 pm

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by marcmerlin »

Very good call, this is what I get. Note the 1023 stuck in there with Transfer-Encoding: chunked.
Is it a bug where zoneminder can't deal with chunked data?

HTTP/1.1 200 OK
Set-Cookie: AIROS_SESSIONID=f412c68b3304cc5d4bc704d608211872; Path=/; Version=1
Content-Type: image/jpeg
Transfer-Encoding: chunked
Date: Wed, 12 Jun 2013 19:12:03 GMT
Server: lighttpd/1.4.31

1023
^@^PJFIF^@^A^A^@^@^A^@^A^@^@^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H

instead of
HTTP/1.0 200 OK
Set-Cookie: AIROS_SESSIONID=b8f408117e13b04ed5511f4add3b732c; Path=/; Version=1
Content-Type: image/jpeg
Connection: close
Date: Wed, 12 Jun 2013 19:13:28 GMT
Server: lighttpd/1.4.31

^@^PJFIF^@^A^A^@^@^A^@^A^@^@^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
marcmerlin
Posts: 93
Joined: Thu Jan 17, 2013 6:13 pm

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by marcmerlin »

As an update, I only get 1-2fps from that camera via snapshot.cgi, so I guess I'm back to using its dodgy RTSP stream, which seems to trigger other bugs in ZM (I get alarm times of hours just on that camera, even if nothing is moving in front of it).
Either way, thanks for your help.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by mastertheknife »

You guessed right. ZoneMinder does not support chunked encoding.
Kfir Itzhak.
marcmerlin
Posts: 93
Joined: Thu Jan 17, 2013 6:13 pm

Re: ubnt aircam snapshot.cgi =>Found bogus jpeg header '3130

Post by marcmerlin »

Just curious, do I have the first reported camera that tries chunked encoding in http 1.1?
If so, then hopefully the next person will find this thread.
If not, should the code either add support, or revert to http 1.0 by default if it's not fully http 1.1 compatible, or does that break other things?
Locked