View Full Version : JPEG decode failure

May 21st, 2009, 04:44 PM
Boxee can't seem to decode any of the JPEG thumbnails we use, e.g.


This file begins with SOI marker 0xFFD8 followed by a comment marker 0xFFFE

In boxee- method CxImageJPG::Decode() scans for SOI 0xFFD8 followed by 0xFFE0, 0xFFE1 or 0xFFC4. Any other markers like 0xFFD8 and it fails.

This recent patch to ximajpg.cpp (http://github.com/elan/xbmc-sources-fork/commit/ad149d94a077066092ab1af35e463a15c9e842e1) in Plex I think will fix the problem for Boxee, it expands the set of allowable markers following SOI.

Simplest way to reproduce this is to add the following to sources.xml:


Then in the boxee.log you will see:

ERROR: Invalid url:
INFO: msg: Error loading JPEG - no SOI marker found in first 8096 bytes
INFO: msg: Error loading JPEG - no SOI marker found in first 8096 bytes
INFO: msg: PICTURE::CreateThumbnail: Unable to open image: http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg Error:
ERROR: PICTURE::DoCreateThumbnail: Unable to create thumbfile /Users/aw/Library/Application Support/BOXEE/UserData/profiles/rectalogic/Thumbnails/Pictures/7/7e75fea0.tbn from image http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg

May 21st, 2009, 08:19 PM
Yes, we had that same problem. In the end, we ended up creating a proxy php file that converted the files to png's on the fly.

May 28th, 2009, 05:21 PM
I applied the Plex patch to Boxee and rebuilt and it fixed the issue. A Boxee branch with the patch applied is here:


Boxee does have a second issue where if the jpg is returned using Transfer-Encoding: chunked (and so no Content-Length), it also fails. I can fix this on the server side though.

Boxee fails because CxImageJPG::Decode attempts to seek to 0 after finding the SOI, and CFileCurl thinks the length is 0 and so short circuits the seek and the subsequent JPEG decode fails since we did not actually seek to the beginning of the SOI.