Video Layout

Introduction

When multiple users publish live streaming in different rooms or in one room, the platform can also mix multiple audio/video streams from specified rooms into one path for pushing to CDN or to the cloud for recording.

When starting to mix streams through RESTful API, you can set the display position, video screen size, watermark, background and SEI of the user's video screen by selecting the layout templateid or custom options to achieve the best display effect.

  • Layout template : By default, 5 default layout templates are provided. Choose one to set the size and display position of the user's video screen. The default layout templates include : Horizontal, Vertical, Tiled, Corner, 5 Users Horizontal
  • Custom layout : Custom options to achieve the best display effect.

Notices:

  • Layout template is not supported during cross-room stream mixing.
  • Please contact Customer Support for customizing other layout template.

Layout template

Implementation

  1. Call startrecord to start record task and set templateid and output in mixconfig parameters.

    Notices: Watermark (time stamp, text or picture), background or SEI can be set when you fill the values of watermark, background, base64seidata in output .

  2. (Optional) In order to update layout, you can call updatemixrecord to update mixconfig parameters .

Features
Implementation
Layout templateLayout template ID: 1-Horizontal, 2-Vertical, 3-Tiled, 4-Corner, 5-5 Users Horizontal
WatermarkWatermark (time stamp, text or picture) can be set when you fill the values of watermark in output .
BackgroundBackground can be set when you fill the values of background in output .
SEISEI can be set when you fill the values of base64seidata in output .

Horizontal

The first user appears in the large-window picture at the upper side, with other users in the small-window pictures at the lower side. The small-window pictures hover above the large-window picture. Two rows of small windows can be provided at most, each of which can contain 8 pictures. In total, 17 user pictures can be supported in the small windows.

  • For the large image, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be scaled without cropping.
  • For small pictures, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be cropped to fill the small picture.
  • If a user only publishes audio, it will not occupy the layout position.

The effect is as below:
img

Vertical

The first user appears in the large-window picture at the left side, with other users in the small-window pictures at the right side. Two rows of small windows can be provided at most, each of which can contain 8 pictures. In total, 17 user pictures can be supported in the small windows.

  • For the large picture, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be scaled without cropping.
  • For small pictures, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be cropped to fill the small picture.
  • If a user only publishes audio, it will not occupy the layout position.

The effect is as below:
img

Tiled

Automatically adjust the size of each picture based on the number of users. The picture sizes of all users are the same, and 16 pictures (4 x 4) can be supported in total.

  • If the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be cropped to fill the picture.
  • If a user only publishes audio, it will not occupy the layout position.

The effect is as below:
img

Corner

The first user occupies the whole large window, and one small window hovers at each corner. This layout supports four small windows at most, and includes five pictures in total. At present, only a fixed layout is supported. The canvas size is 1280*720, and the size of each small window is 300*300. The distance between the small window and the large window is 10 pixels.

  • For the large picture, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be scaled without cropping.
  • For small pictures, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be cropped to fill the small picture.
  • If a user only publishes audio, it will not occupy the layout position.

The effect is as below:
img

5 Users Horizontal

The first user occupies the whole large window, other users arrange and display the small window screens below, supporting totally 4 small windows at most, and the small window screens are floating above the large window screen. At present, only a fixed layout is supported. The canvas size is 1280*720, and the size of each small window is 300*300. The distance between the small window and the large window is 16 pixels.

  • For the large picture, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be scaled without cropping.
  • For small pictures, if the aspect ratio of the picture is inconsistent with the aspect ratio of the video stream, the output video will be cropped to fill the small picture.
  • If a user only publishes audio, it will not occupy the layout position.

The effect is as below:
img

Custom layout

Implementation

  1. Call startrecord to start record task and set intput and output in mixconfig parameters.

    Notices: Watermark (time stamp, text or picture), background or SEI can be set when you fill the values of watermark, background, base64seidata in output .

  2. (Optional) In order to update layout, you can call updatemixrecord to update mixconfig parameters .

Features
Implementation
Custom layoutInput parameters layoutX, layoutY, layoutH and layoutW in the input of mixconfig to define the display position of the output screen of a user. Please refer to Layout coordinate system.
Crop videoInput parameters cropX, cropY, cropH, cropW in the input of mixconfig to intercept part of the entire user video screen and perform partial output. Please refer to Video cropping coordinate system.
WatermarkWatermark (time stamp, text or picture) can be set when you fill the values of watermark in output .
BackgroundBackground can be set when you fill the values of background in output .
SEISEI can be set when you fill the values of base64seidata in output .

Layout coordinate system

/ Video is the output screen of one user

 |                   videowidth                  |
 |-----------------------------------------------|---
 | (0,0)                                         |
 |                                               |
 |                     (layoutX, layoutY)        |
 |                          |----layoutW-----|   |
 |                          |                |   |  videoheight
 |                  layoutH |                |   |
 |                          |    Video       |   |
 |  Canvas                  |                |   |
 |                          |----------------|   |
 |-----------------------------------------------|---

Video cropping coordinate system

/ original is the original video of one user, crop is the intercepted user video
 |---------------------------------------------|---
 | (0,0)                                       |
 |                                             |
 |                    (cropX,cropY)            |
 |                          |------cropW-----| |
 |                          |                | |
 |                    cropH |                | |
 |                          |     crop       | |
 |  original                |                | |
 |                          |----------------| |
 |---------------------------------------------|---

Was this page helpful?

Helpful Not helpful
Submitted! Your feedback would help us improve the website.
Feedback
Top