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

Wodzu brucedickinson at wp.pl
Sat Dec 22 19:41:14 EET 2018

Hi Carl,

Thank you for taking the time to answer my question. I've tried to remove sws_scale from my code and replaced it with:

av_image_fill_arrays(frame->data, frame->linesize, image_data, AV_PIX_FMT_GRAY8, context->width, context->height, 0)

But now I am getting "Input picture width (1280) is greater than stride (0)" when call to avcodec_send_frame is being made.
frame->linesize data is {1280, 0, 0, 0, 0, 0, 0, 0}  Should I change this manually? I am shooting in the dark here...

Best regards,


> -----Original Message-----
> From: Libav-user [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Carl
> Eugen Hoyos
> Sent: Saturday, December 22, 2018 5:16 PM
> To: This list is about using libavcodec, libavformat, libavutil, libavdevice and
> libavfilter. <libav-user at ffmpeg.org>
> Subject: Re: [Libav-user] sws_scale - "Warning: data is not aligned!" when
> using opencv::Mat
> 2018-12-22 15:33 GMT+01:00, Wodzu <brucedickinson at wp.pl>:
> > I am using this code (simplified to show the issue) to convert from
> Are you sure that you need to convert?
> This depends on the range of your gray8 input, assuming you want mpeg
> range for encoding.
> Newest x264 also supports gray8 as input.
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
> To unsubscribe, visit link above, or email libav-user-request at ffmpeg.org
> with subject "unsubscribe".

More information about the Libav-user mailing list