[Libav-user] Encoding in PIX_FMT_YUYV422

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Jan 23 13:04:26 CET 2012

 <francesco at ...> writes:

> I'm attempting to encode in PIX_FMT_YUYV422 using libavcodec.
> It's not clear to me the format of input raw data.  I understood that
> all pixel should be in 16 Bit format, but in buffer, how should be inserted
> data ?  That is, if locpFrame is a pointer to an AVFrame, I should insert;
> locpFrame->data[0] => The buffer containing only luma samples (Y0,Y1,Y2..)
> locpFrame->data[1] => The buffer containing only Chroma 1 samples
> (Cr0,Cr1,Cr2..)
> locpFrame->data[2] => The buffer containing only Chroma 2 samples
> (Cb0,Cb1,Cb2...)

I suspect this would PIX_FMT_YUV422P

> or:
> 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?)

Carl Eugen

More information about the Libav-user mailing list