All Products
Search
Document Center

ApsaraVideo Media Processing:How do I specify a resolution for an output video?

Last Updated:Jun 22, 2026

In ApsaraVideo Media Processing (MPS), you specify a resolution for output videos through a transcoding template. If the output video appears stretched, the aspect ratio of the input video likely does not match the specified resolution.

Enable auto-rotate screen

If your input videos include both landscape and portrait orientations, such as 1920 × 1080 and 1080 × 1920 pixels, define the output resolution by specifying the longer or shorter side in pixels.

Configuration methods

  • When you create a transcoding template in the MPS console, set the Resolution parameter to Set by Long and Short Sides.

  • When you call the SubmitJobs or AddTemplate operation, set the LongShortMode parameter to true, the Width parameter to the long side of the output video, and the Height parameter to the short side of the output video.

Enable proportional scaling

If your input videos use different aspect ratios, such as 16:9 and 4:3, and you want to preserve the original aspect ratios after transcoding, enable proportional scaling.

  • When you configure a transcoding template, specify either the output width or height and leave the other dimension empty, or specify either the longer or shorter side and leave the other empty. The unspecified dimension is proportionally scaled to match the aspect ratio of the input video.

  • For videos in both landscape and portrait modes, we recommend that you enable auto-rotate screen and define the output resolution by the longer or shorter side. This prevents excessively large or small frame sizes.

    Note

    If you specify only the output width or height, you may be charged at a higher tier than expected. For example, if you set the output height to 720 pixels and the input aspect ratio exceeds 16:9, the output width exceeds 720 pixels, which incurs additional fees.

Configuration methods

  • When you create a transcoding template in the MPS console, set the Resolution parameter to Set by Long and Short Sides or Set by Width and Height and specify only one of the longer side and shorter side or one of the output width and output height.

  • When you call the SubmitJobs or AddTemplate operation, specify only one of the Width and Height parameters and set the LongShortMode parameter to true.

Specify an aspect ratio conversion method

If you specify both the output width and height, or both the longer and shorter sides, and the input aspect ratio does not match the specified resolution, you can perform aspect ratio conversion. MPS adjusts the display aspect ratio (DAR) of the output video by stretching, adding black bars, or cropping the images. You can also retain the original DAR.

Note

The sample aspect ratio (SAR) is the width-to-height ratio of a video frame and represents the actual resolution. The DAR is the ratio at which a video is displayed during playback. An incorrect DAR may cause visible distortion. In most cases the DAR and SAR are identical, but they can differ.

Configuration methods