I.MX8MM Video gets distorted after rotation

When using Gstreamer and rotating video 90 degrees using imxvideoconvert_g2d the video’s aspect ratio gets distorted. I tried swapping height and width values in caps and that helps up to 720p resolution. On 1080p linking with vpuenc_h264 encoder fails. This is probably due to encoder’s default caps: https://github.com/dv1/gstreamer-imx/blob/c19a6ff7db8b346db6582c5d69e01be1b08c9c89/src/vpu/encoder/e…
Any help would be appreciated!

I think you are conflating things. imxvideoconvert_g2d is not part of gstreamer-imx. It is part of the NXP imx-gst1.0-plugin package.