[libav-user] RE : RE : Conversion yuvj420P to RGB24

Mike Scheutzow mjs973 at optonline.net
Sat Aug 21 14:37:21 CEST 2010


Candice Seenyen wrote:
> THanks for your input, but it actually doesn't work. I am using the latest
> version of ffmpeg where YUVJ420P is deprecated, so that could be the
> problem. No idea. I'll look into it.
>   

Please don't top-post in this list.

Looking at the FFmpeg source code, in pixfmt.h I see the "deprecated" 
comment you are talking about. But I think it is not completely 
accurate. PIX_FMT_YUVJ420P might be deprecated for libavcodec, but it's 
not deprecated for libswscale.

For libavcodec, the new approach is to use PIX_FMT_YUV420P together with 
AVCOL_RANGE_JPEG.

This change means that if you want your code to handle full-range 
pixels,  you have to add new lines of code that check 
AVCodecContext->color_range, then pass the correct PIX_FMT_* value to 
sws_getContext(). I didn't create a test case, but looking at the source 
code it appears that libswscale does the right thing with PIX_FMT_YUVJ420P.

Switching topics, an all green output from YUV->RGB conversion usually 
means that the input YUV buffer was all zeros. You should use a debugger 
to confirm that you see non-zero data in the input Y plane buffer.

For debugging, you might also try --disable-optimizations and 
--disable-asm when you configure FFmpeg. This will slow down execution a 
lot, but might help you figure out where the problem is.

-- 
Mike Scheutzow




More information about the libav-user mailing list