Re: [MPlayer-dev-eng] key frame extractor / vo_jpeg use YV12 instead of RGB patch
Trent Piepho
xyzzy at speakeasy.org
Sat Mar 17 01:03:23 CET 2007
On Fri, 16 Mar 2007, Andreas Krebs wrote:
> > You are not doing it quite right though. The YUV data in video formats is
> > almost never full range, but has something called ccir r.601 excursions.
> > JFIF standard jpegs on the other had have full-range yuv data. So, you
> > must convert one to the other if you want to create standard jpeg files.
>
> I wasn't aware of this - thanks for letting me know. I guess this is the reason
> why my images looked different than the images produced by the original vo_jpeg.
>
> this means I would have to scale each Y value to full range, is there
> already an algorithm available for this? or better can I define a different YUV
> format, so that the data passed to vo_jpeg already correctly scaled?
> the Cb Cr values are not scaled - is this correct?
Chroma is scaled too. swscaler has some support for JPEG range YUV data,
if you look at the code you can see stubs for it. I don't think it totally
works.
Fixing vo jpeg to use YUV output is something I've wanted to do but never
got around to. I also figured I've have no luck getting a patch accepted.
Good luck to you.
AFAIK, there is no standard for putting R.601 excursion yuv data in a jpeg.
This does not mean you can't do it, after all, you just did. Other people
will not understand your jpeg files, but maybe that is ok.
If you want to extract frames in jpeg format and then later convert them
back into a video of some kind, it makes sense not scale from R.601 to
JFIF, then from JFIF back to R.601.
So anyway, I thought JFIF vs R.601 range should be an option for vo jpeg.
It is also possible to put RGB in a JPEG file. This is NOT what vo jpeg
does now. Now it uses swscaler to convert YUV to RGB, then libjpeg code
(slow) converts back to YUV. It is possible to create RGB jpeg files, and
many apps support them. If you use lcms to color correct photos under
linux, it produces RGB jpegs. I thgouht it would be interesting to support
this.
Another wrinkle is that all YUV is not the same. There are different
colorspaces that all get lumped together under YUV. If you read the MPEG-2
spec, there is information about the different colorspaces that can be
specified. Charles Poynton has a good FAQ about color spaces.
JFIF uses a YUV color space from R.601, but will full range excursions.
Most videos also use R.601, but with limited excursions. For HD content,
usually a colorspace called R.709 is used.
More information about the MPlayer-dev-eng
mailing list