[Libav-user] 980210 - What is wrong while providing arguments for sws_scale?!
Carl Eugen Hoyos
ceffmpeg at gmail.com
Tue Apr 30 17:54:42 EEST 2019
2019-04-30 13:34 GMT+02:00, hamidi <hamidi at gmail.com>:
> Hi
> In the following code, I can't figure out what's wrong:
>
> uint8_t *dstData[4];
> int dstLinesize[4];
> AVPixelFormat convertToPixFmt = AV_PIX_FMT_RGBA;
> int ret;
>
> // ...
>
> printf("tmp_frame format: %d (%s) %dx%d\n", tmp_frame->format,
> av_get_pix_fmt_name((AVPixelFormat)tmp_frame->format), tmp_frame->width,
> tmp_frame->height);
> // The above line prints: tmp_frame format: 23 (nv12) 480x480
>
> int size = av_image_get_buffer_size(convertToPixFmt, tmp_frame->width,
> tmp_frame->height, 1);
> uint8_t *buffer = (uint8_t *) av_malloc(size);
>
> ret = av_image_copy_to_buffer(buffer, size,
> (const uint8_t * const *)&tmp_frame->data[i],
Why are you copying the temporary frame instead
of passing its pointer to sws_scale()?
Carl Eugen
More information about the Libav-user
mailing list