Please ignore last sentence relating to memcpy, I chose wrong pixel format,
correct pixel format is AV_PIX_FMT_UYVY422

On Fri, Apr 24, 2015 at 1:09 PM, Nisar Ahmed <nisar....@gmail.com> wrote:

> 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
> memcpy?).
>
>             //initializing destination buffer
>
>             ret = av_image_alloc(video_dst_data, video_dst_linesize,
>
>                                  video_dec_ctx->width, video_dec_ctx->
> height, AV_PIX_FMT_YUYV422, 1);
>
>                       //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,
> NULL, NULL, NULL);
>
>
>                       //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 <ceho...@ag.or.at>
> wrote:
>
>> Nisar Ahmed <nisar.med@...> 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@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>
>
_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to