Hi all,
Here is a part of my code,
Code:
convertCtx = sws_getContext(aWidth, aHeight, PIX_FMT_RGB24, aWidth, aHeight, PIX_FMT_YUV420P, SCALING_ALGORITHM, NULL, NULL, NULL);
x264_picture_alloc(&pic_in, X264_CSP_I420, aWidth, aHeight);
srcstride = aWidth*3;
sws_scale(convertCtx, &bits, &srcstride, 0, aHeight, pic_in.img.plane, pic_in.img.i_stride);
In the code, I fisrt convert the RGB frame to YUV 4:2:0 and send it for encoding.
This code works perfect for for example 1024x768 resolution input frames but not for example 1366x768. It gives an error "Warning: data is not aligned!". I am guessing that it is just because 1366 is not divisible by 4. I thought that I can fix it by playing with the srcstride parameter but it won't help. Could you please guide me how to fix this properly?