swscale seems to access memory which it isn't allowed sometimes; maybe this is due to memory alignment and I seem to have fixed it be added 4 bytes to the image buffer