[Libav-user] Swscale bad dst image pointers

gga ggarra13 at gmail.com
Mon Nov 25 01:24:13 EET 2019



On 20/11/19 03:19, Dorian Green wrote:
> Hello, can someone enlighten me as to why this gives error -22 
> "invalid argument" which results in bad dst image pointers?
>
> ------------------------------------------------------
>
> AVFrame * frame = av_frame_alloc();
> If (!frame){
>
> std::cout << "frame failed to initialize" << std::endl;
>
> }
>
> Int size = 
> av_image_get_buffer_size(pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,0);
>
> auto picture_src = (uint8_t*)av_malloc(sizeof(uint8_t) * size);
>
> av_image_fill_arrays(frame->data,frame->linesize,picture_src,pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,0);
>
You might want to set the alignment to 1, just in case.
>
> sws_scale(img_convert_ctx, 
> frame->data,frame->linesize,0,pCodecContext->height,frame->data,frame->linesize);
>
> ----------------------------------------------------
> What is it that i'm not understanding?

You are using sws_scale to decode to the same pointers it is reading 
from.  That's more likely your problem.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20191124/13a4c711/attachment.html>


More information about the Libav-user mailing list