320x180 is a 16:9 ratio, while the size you get in your requests (320x240) is a 4:3 ratio.
The reason you get this is probably that the videos you are requesting were streamed/encoded in a 4:3 format.
If you want the exact size, regardless of ratio, you could use the template and specify your own size, but you will get the black borders. I would personally strictly make my application support 16:9 format since it’s most common, and just rescale the odd ones on the client side, possibly clipping them to keep the image aspect ratio while showing them as the same size.