Skia cannot decode MJPEG stream from Logitech camera

223 views
Skip to first unread message

ndnfan

unread,
Dec 3, 2011, 9:18:53 PM12/3/11
to skia-discuss
Hi,

I created an Android application that reads a MJPEG stream from a
Logitech
Quickcam Pro 9000. My application parses each frame from the stream
and attempts to create a bitmap from it. I'm no expert in graphic
formats, but the message looks like a JPEG header to me (except it
seems to be missing Huffman tables). But it does have the SOI (0xFF,
0xD8) and SOS (0xFF, 0xDA) and the frame ends with an EOI (0xFF,
0xD9).

ff d8 ff e0 00 21 41 56 49 31 00 01 01 01 00 78 00 78 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff db 00 43 00 0e 09 0a 0c
0a 08 0e 0c 0b 0c 0f 0e 0e 10 15 23 16 15 13 13 15 2a 1e 20 19 23 32
2c 35 34 31 2c 31 37 38 3f 50 44 38 3b 4c 3c 30 31 46 5b 46 4c 53 55
5a 5b 5a 36 43 62 69 62 57 69 50 58 5a 56 ff db 00 43 01 0e 0f 0f 15
12 15 29 16 16 29 56 39 31 39 56 56 56 56 56 56 56 56 56 56 56 56 56
56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56
56 56 56 56 56 56 56 56 56 56 56 56 56 56 ff c0 00 11 08 02 58 03 20
03 01 21 00 02 11 01 03 11 01 ff da <image data> ff d9 00

However when I pass this stream into BitmapFactory::decodeStream, I
get a null back and this message in the LogCat:
2-03 13:03:57.844: D/skia(542): --- decoder->decode returned false

Can anyone help me understand how I can convert this stream into
something that BitmapFactory can understand? If you can point me to
some documentation or sample code, that'd be great.

Thanks,
-Matt

ndnfan

unread,
Dec 4, 2011, 9:37:35 PM12/4/11
to skia-discuss
I found the solution here:
http://code.google.com/p/python-video4linux2/issues/detail?id=13

A pretty simple solution -- just add a fixed Huffman table to the
header.

Reply all
Reply to author
Forward
0 new messages