[Libav-user] Packed variant of PIX_FMT_YUV420P

Nisar Ahmed nisar.med at gmail.com
Fri Apr 24 10:09:20 CEST 2015

I am demuxing and decoding a quicktime movie file using libav, the decoder
always produces a frame in YUV420P, this frame has to go to the DeckLink's
frame buffer which expects the format to be YUYV422. Now I need to convert
to the desired pix format for which I am using sws_scale.

I was wondering whether is it possible to tell the decoder to decode in
YUYV422 to save an additional conversion step? if not then is sws_scale the
only option for the conversation. The conversion is happening but somehow
the resulting frame has colours inverted (is the byte order changing during

            //initializing destination buffer

            ret = av_image_alloc(video_dst_data, video_dst_linesize,

                                 video_dec_ctx->width, video_dec_ctx->height,

                      //initializing context

            sws = sws_getContext(video_dec_ctx->width, video_dec_ctx->height,
video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height,

                                  AV_PIX_FMT_YUYV422, SWS_FAST_BILINEAR,

                      //performing conversion, frame holds the decoded
pixels from the decoder id dvvideo

            int status = sws_scale(sws, frame->data, frame->linesize, 0,
frame->height, video_dst_data, video_dst_linesize);

            memcpy((char*)buffer, video_dst_data[0], video_dst_linesize[0]
* video_dec_ctx->height);

On Thu, Apr 23, 2015 at 9:04 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Nisar Ahmed <nisar.med at ...> writes:
> > Where is packed variant of planar YUV420P format,
> > I need packed version instead of planar while
> > demuxing when libav
> Can you explain your usecase? I don't remember
> seeing packed yvu420.
> Note that demuxing does not produce pix_fmts...
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150424/593ab359/attachment.html>

More information about the Libav-user mailing list