Video Layout

1. Introduction

  • When multiple users join a room, the platform can mix multiple audio/video streams into one path, then push it to CDN or to the cloud for recording.
  • When users publish live streaming in different rooms, 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.

2. Parameters

NameTypeRequiredSample ValueDescription
inputJSONArrayNo123456789Input parameters, optional for those using a layout template ID for mixing streams
outputJSONYes Output parameters
templateidnumberNo Layout template ID:
1: Horizontal Layout
2: Vertical Layout
3: Tiled Layout
4: Corner Layout
Only valid for stream mixing in one room

2.1 Input Parameters

NameTypeRequiredSample ValueDescription
uidstringYes123456789Source stream user ID
roomidstringYes1001Room ID of the source stream user
streamtypeintYes0Stream type:
0: audio/video
1: video
2: audio
Value range: 0,1,2
layerintYes0(Deprecated, updated to the parameter zOrder)
Layer (0 indicates the bottommost layer and 1 is the first layer from bottom to top, and so on, up to 16 layers)
zOrderintYes0Layer (0 indicates the bottommost layer and 1 is the first layer from bottom to top, and so on, up to 16 layers)
pos_xintYes0(Deprecated, updated to the parameter layoutX)
Top left x-coordinate in canvas (coordinate system: abscissa axis extended rightward and ordinate axis extended downward)
Value range: (0, 10000)
layoutXintYes0Top left x-coordinate in canvas (coordinate system: abscissa axis extended rightward and ordinate axis extended downward)
Value range: (0, 10000)
pos_yintYes0(Deprecated, updated to the parameter layoutY)
Top left y-coordinate in canvas
Value range: (0, 10000)
layoutYintYes0Top left y-coordinate in canvas
Value range: (0, 10000)
pos_hintYes0(Deprecated, updated to the parameter layoutH)
Height in canvas
Value range: (0, 10000)
layoutHintYes0Height in canvas
Value range: (0, 10000)
pos_wintYes0(Deprecated, updated to the parameter layoutW)
Width in canvas
Value range: (0, 10000)
layoutWintYes0Width in canvas
Value range: (0, 10000)
cropintNo0Zooming display options
0: centered display of input stream, with black sides filled
1: filling in input stream as much as possible, and centering and cropping
Value range: 0 or 1
cutout_xintNo0(Deprecated, updated to the parameter cropX)
An x coordinate of a cutout region in an original image if an input is a cutout image from the original image
Value range: (0, 10000)
cropXintNo0An x coordinate of a cutout region in an original image if an input is a cutout image from the original image
Value range: (0, 10000)
cutout_yintNo0(Deprecated, updated to the parameter cropY)
An y coordinate of a cutout region in an original image if an input is a cutout image from the original image
Value range: (0, 10000)
cropYintNo0An y coordinate of a cutout region in an original image if an input is a cutout image from the original image
Value range: (0, 10000)
cutout_hintNo0(Deprecated, updated to the parameter cropH)
Height of a cutout region if an input is a cutout image from the original image
Value range: (0, 10000)
cropHintNo0Height of a cutout region if an input is a cutout image from the original image
Value range: (0, 10000)
cutout_wintNo0(Deprecated, updated to the parameter cropW)
Width of a cutout region if an input is a cutout image from the original image
Value range: (0, 10000)
cropWintNo0Width of a cutout region if an input is a cutout image from the original image
Value range: (0, 10000)
alphafloatNo0.5Transparency in mixed flow, value range: (0, 1.0). 0 means completely transparent, 1.0 means completely opaque.

2.2 Output Parameters

NameTypeRequiredSample valueDescription
streamtypeintYes0Stream type:
0: audio/video
1: video
2: audio
Value range: 0,1,2
videoheightintNo600Video height, with the value range: (0, 10000) and being integral multiples of 8
videowidthintNo800Video width, with the value range: (0, 10000) and being integral multiples of 8
videobitrateintNo800Video bit rate in kbps, with the value range: (0, 10000]
videofpsintNo15Video frame rate, with the value range: (0, 60]. The default value is 15fps. If video frame rate is set higher than 60, the service will be adjusted to 60.
videogopintNo30Video GOP, value range (0, 1000). The unit is frame and the default value is 30 frames. Adopting calculation method: multiplying GOP time interval (in second) by videofps.
When it is not satisfied, it will round up and adjust the videogop.
videoencodeintNo100Video encoding
100: H264 (default)
101: H265 (not supported)
audiobitrateintNo64Audio bit rate (kbps). Fill in a fixed value (64), and adjust the value based on the audioencode value.
audiochannelintNo2Number of audio tracks, and a fixed value (2) filled in
audiosampleintNo44100Audio sampling rate, and a fixed value (44100) filled in
audioencodeintNo1Audio code
1: AAC+
35: AAC (128 kbps)
patchintNo1Video frame patching method:
0: not patching the frame
1: patching black screen
2: patching the last frame
3: patching the specified picture
patchUrlstringNo When video frame patching method is 3, specifying the picture address with the length not more than 256 bytes

2.3 Layout Template

2.3.1 Horizontal Layout

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.

  • When the number of video pictures is 2-5, the effect is as follows:
    img
  • When the number of video pictures is 6-7, the effect is as follows:
    img
  • When the number of video pictures is 8-9, the effect is as follows:
    img
  • When the number of video pictures is 9-17, the effect is as follows:
    img

2.3.2 Vertical Layout

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.

The large-window picture and the small-window pictures are separated.

  • 2-5 windows are displayed as below:
    img
  • 6-7 windows are displayed as below:
    img
  • 8-9 windows are displayed as below:
    img
  • 9-17 windows are displayed as below:
    img

2.3.3 Tiled Layout

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.

  • When the number of video pictures is 2, the effect is as below:
    img
  • 3-4 windows are displayed as below:
    img
  • 5-9 windows are displayed as below:
    img
  • 10-16 windows are displayed as below:
    img

2.3.4 Corner Layout

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 effect is as follows:
img

3. Notices

  • The stream mixing template is not supported during cross-rooml stream mixing.
  • Please contact Customer Support for customizing other layout templates.
<