|
|
| Landrew |
| Posted: Jul 10 2010, 09:52 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 102
Member No.: 17383
Joined: 1-December 05

|
Hey,
My understanding has always been that MJPEG is an oddball with regards to YUV in that according to the JFIF spec, it uses the full range 0-255. And then about 6 months ago, Ffdshow changed its handling of conversion for MJPEG to use the restricted range ala standard Rec 601. So now any MJPEG encoded with Ffdshow plays backs with messed up contrast in popular players and editors.
Am I confused, or was this a boo-boo in Ffdshow? I posted to the bugs forum on ffdshow-tryouts a few months ago but no replies. Just looking for a reality check. I am considering writing a Vdub filter to do the JFIF conformant conversion and force feed it into Ffdshow just so I can get my work done.
Cheers, Landrew |
 |
| phaeron |
| Posted: Jul 11 2010, 08:44 PM |
 |
|

Virtualdub Developer
  
Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02

|
JPEG, JFIF, and MJPEG are all different.
JPEG is the encoding standard, which specifies how to decode the image stream. It does not specify the color space, only how to decode one or more raw channels. JFIF is a standard that is used with JPEG to provide that information, by way of an APP0 chunk at the beginning of the stream. Motion JPEG is based on JPEG but not JFIF and does not have a JFIF APP0 chunk in the stream, so there is no requirement that MJPEG streams follow the color spaces defined by JFIF.
Now, as to the color space used, JFIF does indeed specify a full-range encoding that is different from Rec. 601 or Rec. 709. Unfortunately, Microsoft's original Motion JPEG spec did not specify the color space, and whatever it did specify became irrelevant once they released the MJPEG Decoder in DirectShow, which only follows about half of the original spec and allows lots of deviations from the standard (most notably custom Huffman tables). As such, currently in AVI at least the de-facto standard is to use limited range encoding in Motion JPEG streams. |
 |
| Landrew |
| Posted: Jul 15 2010, 07:59 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 102
Member No.: 17383
Joined: 1-December 05

|
Thanks! That distinction between the standards makes perfect sense.
As far as ranges go in practice, my experience as a film maker is that cameras, editors and players typically use the full range for MJPEG. So its a pain that ffdshow suddenly switched. High quality 422 MJPEG was not actually a terrible way to give processed results to people. Easy for them to decode, edit, play on any system without much technical expertise. But now the contrast levels are altered if I encode with ffdshow.
As an interesting note, with the latest versions, ffmpeg uses the full range, while ffdshow does not.
Cheers, Landrew |
 |
| Wilbert |
| Posted: Jul 17 2010, 08:27 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 132
Member No.: 6270
Joined: 11-September 03

|
| QUOTE | | Ffdshow changed its handling of conversion for MJPEG to use the restricted range ala standard Rec 601. So now any MJPEG encoded with Ffdshow plays backs with messed up contrast in popular players and editors. |
Just curious. In what way did ffdshow change? I would say that if you pass YCbCr [0,255] and encode with ffdshow/mpjeg it leaves the lumarange unaltered? Then it's up to the player/rendered to do the right thing upon display. Isn't this the case? |
 |
| Landrew |
| Posted: Jul 17 2010, 09:47 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 102
Member No.: 17383
Joined: 1-December 05

|
Yes, if you give YUV directly to ffdshow it will encode whatever you give it without alteration.
Do you know a way to tell editors like Adobe Premiere to do RGB to YUV conversion on export using the full range? How about VDub? That would be quite useful. |
 |