I can't tell if WebP supports encoding from a RGB_565 stream, my guess is no.
As an alternative, you can convert it to RGB_888 such as in the answers given here: How does one convert 16-bit RGB565 to 24-bit RGB888?
And then the correct way to do stride is simply width*bytesPerPixel
, or in the case of RGB_888 it would be width * 3
. When encoding RGBA_8888 it would be width * 4
.