logo
On this page

Mixed-stream recording


We currently support the following cloud recording modes:

  • Single-stream recording: All the audio, video streams, and whiteboard recordings in a room are recorded in separate files.

  • Mixed-stream recording: The audio, video streams, and whiteboard recordings in a room are recorded in a single file.

This document describes how to implement mixed-stream recording by using the cloud recording APIs.

Implementation

To use the mixed-stream recording, call the StartRecord method, and set the RecordMode parameter to 2.

You can select the format of the recorded file as needed by setting the OutputFileFormat parameter to mp4, flv, or hls.

For instance, set the OutputFileFormat parameter to mp4, and the generated recordings are varies based on the content to be recorded:

Content to be recorded

Parameter

Recorded file
Audio onlySet StreamType to "1"The audio streams of all stream IDs are recorded in a single mp4 file.
Video onlySet StreamType to "2"The video streams and whiteboard recordings of all stream IDs are recorded in a single mp4 file.
Audio and video (mixed)Set StreamType to "3"The audio, video streams, and the whiteboard recordings of all stream IDs are recorded in a single mp4 file.
Record audio and video (separate)Set StreamType to "4"The audio, video streams, and the whiteboard recordings of all stream IDs are recorded in an mp4 and an aac file. The mp4 file contains the video and whiteboard data, and the aac file contains the audio data.

In the mixed-stream recording, you will need to set the resolution, frame rate, bitrate of the output video with the MixOutputVideoConfig parameter. We recommend you refer to the following table:

Warning
  • Higher resolution is not always better. We recommend not to set a higher resolution than the original video stream; otherwise, the final recorded file may be blurry.
  • The resolution here refers to the resolution of the video canvas in mixed-stream recording mode, and its aspect ratio does not need to be consistent with the original video. The aspect ratio of the user video image in the output video depends on the aspect ratio of the video canvas and the mixed-stream layout.
  • The bitrates in the following table vary according to different scenarios. A larger bitrate is usually required in live streaming scenarios to improve video quality, which is about twice that of the communications scenario.
Resolution (width * height)Frame rate (fps)Bitrate for communications (bps)Bitrate for live streaming (bps)
160 * 1201565,000130,000
120 * 1201550,000100,000
320 * 18015140,000280,000
180 * 18015100,000200,000
240 * 18015120,000240,000
320 * 24015200,000400,000
240 * 24015140,000280,000
424 * 24015220,000440,000
640 * 36015400,000800,000
360 * 36015260,000520,000
640 * 36030600,0001,200,000
360 * 36030400,000800,000
480 * 36015320,000640,000
480 * 36030490,000980,000
640 * 48015500,0001,000,000
480 * 48015400,000800,000
640 * 48030750,0001,500,000
480 * 48030600,0001,200,000
848 * 48015610,0001,220,000
848 * 48030930,0001,860,000
640 * 48010400,000800,000
1280 * 720151,130,0002,260,000
1280 * 720301,710,0003,420,000
960 * 72015910,0001,820,000
960 * 720301,380,0002,760,000
1920 * 1080152,080,0004,160,000
1920 * 1080303,150,0006,300,000

Sample request

  • Content-type: application/json;charset=utf-8

The request example of StartRecord is as follows:

Untitled
{
	"RoomId": "xxxx",
	"RecordInputParams": {
		"RecordMode": 2,
		"StreamType": 3,
		"MaxIdleTime": 60,
		"MixConfig": {
			"MixMode": 2,
			"MixOutputStreamId": "mix",
			"MixOutputVideoConfig": {
                "Width": 1280, 
                "Height": 720, 
                "Fps": 15, 
                "Bitrate": 1130000
        }
		}
	},
	"RecordOutputParams": {
		"OutputFileFormat": "mp4",
		"OutputFolder": "record/"
	},
	"StorageParams": {
		"Vendor": 2,
		"Region": "oss-xxxx",
		"Bucket": "xxxx",
		"AccessKeyId": "xxxx",
		"AccessKeySecret": "xxxx"
	}
}
1
Copied!

Previous

Single-stream recording

Next

Set mixed-stream layout