All Products
Search
Document Center

:The video image has a gap with black borders

Last Updated:May 20, 2022

Problem description

A gap in the video appears black when you use the player. The following figure shows the video image.

Possible cause

The aspect ratio of the player is different from that of the video.

Solution

  1. View the width and height of the video image, and the vedioWidth and vedioHeight parameters of the player.
    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.
  2. Adjusts the ratio of vedioWidth/vedioHeight to be the same as the width/height ratio.
    Note: 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.
  3. After the aspect ratio is adjusted, play the video image and ensure that the player does not have margins.

Application scope

  • ApsaraVideo Live