[Libav-user] Help with sws_scale

Arthur Muller muller at vki.com
Fri Jan 29 21:14:33 CET 2016



I'm trying to convert an RGB image to YUV to generate a video. My image is
sized 640 x 480. These are my steps:


unsigned char rgbdata[3*640*380]; // contains my rgb data

uint8_t *inData[1] = { rgbdata };

int inLinesize[1]  = { 3*640 };

AVFrame *frame;


frame = av_frame_alloc();

frame->format = AV_PIX_FMT_YUV420P;

frame->width  = 640;

frame->height = 480;

av_frame_get_buffer (frame,32);


sws_ctx = sws_getContext

sws_scale(sws_ctx,inData,inLinesize,0,480,frame->data, frame->linesize);


I do have checks after allocating the frame and getting the context,  but I
removed them here for clarity. The program crashes in sws_scale.


Can anybody point me in the right direction?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160129/7743a54e/attachment.html>

More information about the Libav-user mailing list