[Libav-user] Encoding in PIX_FMT_YUYV422

francesco at bltitalia.com francesco at bltitalia.com
Tue Jan 24 08:48:14 CET 2012

At 15.30 23/01/2012 +0000, you wrote:
> <francesco at ...> writes:
>> >> locpFrame->data[0] => The buffer containing packetized samples,
>> >> Y0,Cr0,Y1,Cb0,Y2,Cr1,Y3,Cb1....
>> >
>> >This is approximately PIX_FMT_YUYV422, but I suspect you have Cr and Cb
>> swapped,
>> >please see libavutil/pixfmt.h
>> >(Or is the comment wrong there?)
>> why you state that this is "approximately" PIX_FMT_YUYV422 ?
>What is unclear about "I suspect you have Cr and Cb swapped"?
>(But as said, I don't know if the comment in pixfmt.h is correct.)
>> I read libavutil/pixfmt.h but from this header and from  the source code
>> example it's not clear to me how I should insert data.  I start from a raw
>> image and would compress it in MPEG2 4:2:2 format.
>As said, you cannot use PIX_FMT_YUYV422 because no encoder supports it.
>The mpeg2 encoder does support PIX_FMT_YUV422P though.
>Carl Eugen
>Libav-user mailing list
>Libav-user at ffmpeg.org
>__________ Informazioni da ESET NOD32 Antivirus, versione del database
delle firme digitali 6817 (20120122) __________
>Il messaggio è stato controllato da ESET NOD32 Antivirus.
Hi Mr Eugen
now is more clear. But if I use PIX_FMT_YUV422P the comment is not clear
too.  It says :

///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)

even though the two Croma are inverted, the difference will be in colors.
If they are swapped (little endian instead of big endian due to the fact
that is in 16 bit format), the final image will have wrong colors.
What I haven't understood is how to pass data to encoder. That is, should I
use three different buffers (for luma, Cr and Cb) or a single buffer?
Thanks for the patience

More information about the Libav-user mailing list