[FFmpeg-devel] [PATCH] Set color_space instead of deprecated?YUVJ* pixel formats

Gavin Kinsey gkinsey at ad-holdings.co.uk
Thu Sep 1 09:20:44 CEST 2011

On Wednesday 31 August 2011 21:13:01 Michael Niedermayer wrote:
> On Wed, Aug 31, 2011 at 02:02:40PM +0100, Gavin Kinsey wrote:
> > On Wednesday 31 August 2011 13:52:35 Gavin Kinsey wrote:
> > > On Wednesday 31 August 2011 13:27:56 Michael Niedermayer wrote:
> > > > On Wed, Aug 31, 2011 at 08:20:47AM +0100, Gavin Kinsey wrote:
> > > > > Set color_space instead of deprecated YUVJ* pixel formats in
> > > > > MJPEG decoder.
> > > > 
> > > > i think the pixel format should be left for compatibility for now,
> > > > just setting color_range in addition seems better
> > > 
> > > The colour conversion is different in that case.  Something different
> > > happens in swscale if the pixel format is YUVJ*, with or without
> > > color_range.
> > > 
> > > Now perhaps this altered colour palette is correct, it wouldn't be
> > > the first time our servers send the wrong data, but it just looks
> > > washed-out to me.
> as you say "our servers" could you maybe check what they send and
> elaborate on that a bit ?
> I see various possibilities
> 1. the mjpeg stream in some container is always supposed to use YUV
>    instead of YUVJ, this could be confirmed if you could find some
>    official stream and a official decoder
> 2. the server if it uses ffmpeg uses the wrong pixel format
> 3. something else

I will talk to some of the server guys today and see if I can get some more 
information about exactly how the colour space is being handled.  A cursory 
inspection of the JPEG data looks like it is using the full range as I would 
expect.  Then again the image viewer displays the JPEG the same way ffplay 
does, implying that ffplay *is* doing the right thing when it is set to YUVJ 
and wrong when YUV.

> but simply setting yuv instead of yuvj for all *jpeg isnt the solution
> that will definitly be wrong for normal jpegs

But I thought that was the entire idea, that setting YUV420p + 
AVCOL_RANGE_JPEG is the correct thing to do.  Otherwise YUVJ* shouldn't be 

I understand keeping YUVJ* in for application compatibility, but YUV420p + 
AVCOL_RANGE_JPEG should be functionally equivalent to YUVJ420p inside ffmpeg.  
If it isn't, then that's a bug surely?  Or am I misunderstanding something?

Gavin Kinsey
AD Holdings Plc

Closed IPTV, the new safe and secure deterministic IP Video solution from Dedicated Micros, is now shipping through selected distributors.
- Come and see this award winning plug and play, IP Video innovation at one of our Roadshows around the UK visit: https://www.dedicatedmicros.com/europe/ClosedIPTVRoadshow2011
- Contact our Customer Services Team for more information regarding how to enter the world of safe and secure hybrid IP and analogue video surveillance systems.

More information about the ffmpeg-devel mailing list