[Libav-user] sws_scale - "Warning: data is not aligned!" when using opencv::Mat

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Dec 28 13:10:21 EET 2018


2018-12-22 15:33 GMT+01:00, Wodzu <brucedickinson at wp.pl>:

> I would like to kindly ask for help with warning message called from
> sws_scale.
>
>
>
> I am using this code (simplified to show the issue) to convert from
> AV_PIX_FMT_GRAY8 to AV_PIX_FMT_YUV420P:
>
>
>
>   void Encoder::Encode(uint8_t *image_data)
>
>   {
>
>        av_frame_make_writable(frame);
>
>        const int linesize[1] = { context->width };
>
>        sws_scale(sws_context, &image_data, linesize, 0, context->height,
> frame->data, frame->linesize);
>
>   }

How do you allocate image_data, how do you allocate frame?
What is the stride in your example?

Carl Eugen


More information about the Libav-user mailing list