Black borders or gaps appear around the video when the player aspect ratio does not match the video aspect ratio.
Problem description
Black borders appear around the video image during playback, as shown in the following figure.

Possible cause
The aspect ratio of the player does not match the aspect ratio of the video.
Solution
- View the width and height of the video image, and the vedioWidth and vedioHeight parameters of the player. Note
Note: you can use ffplay or related video analysis tools to view the width and height parameters. If you use apsaravideo player, you can view the width and length set when initializing the player.
- Adjusts the ratio of
vedioWidth/vedioHeightto be the same as thewidth/heightratio.NoteNote: note the following points when adjusting the aspect ratio of the player and the aspect ratio of the video:
- If you are using apsaravideo player, adjust the values of the attributes and methods parameters. For more information, see
vediowdth/vedioheight. - If you are using a live stream, you can see custom encoding to transcode the video
by height. - If you are using on-demand streams, you can transcode the video by transcode. For more information, see
transcode.
- If you are using apsaravideo player, adjust the values of the attributes and methods parameters. For more information, see
- After the aspect ratio is adjusted, play the video image and ensure that the player does not have margins.
Application scope
- ApsaraVideo Live