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 only | Set StreamType to "1" |
The audio streams of all stream IDs are recorded in a single mp4 file. |
Video only | Set 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:
- 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 * 120 | 15 | 65,000 | 130,000 |
120 * 120 | 15 | 50,000 | 100,000 |
320 * 180 | 15 | 140,000 | 280,000 |
180 * 180 | 15 | 100,000 | 200,000 |
240 * 180 | 15 | 120,000 | 240,000 |
320 * 240 | 15 | 200,000 | 400,000 |
240 * 240 | 15 | 140,000 | 280,000 |
424 * 240 | 15 | 220,000 | 440,000 |
640 * 360 | 15 | 400,000 | 800,000 |
360 * 360 | 15 | 260,000 | 520,000 |
640 * 360 | 30 | 600,000 | 1,200,000 |
360 * 360 | 30 | 400,000 | 800,000 |
480 * 360 | 15 | 320,000 | 640,000 |
480 * 360 | 30 | 490,000 | 980,000 |
640 * 480 | 15 | 500,000 | 1,000,000 |
480 * 480 | 15 | 400,000 | 800,000 |
640 * 480 | 30 | 750,000 | 1,500,000 |
480 * 480 | 30 | 600,000 | 1,200,000 |
848 * 480 | 15 | 610,000 | 1,220,000 |
848 * 480 | 30 | 930,000 | 1,860,000 |
640 * 480 | 10 | 400,000 | 800,000 |
1280 * 720 | 15 | 1,130,000 | 2,260,000 |
1280 * 720 | 30 | 1,710,000 | 3,420,000 |
960 * 720 | 15 | 910,000 | 1,820,000 |
960 * 720 | 30 | 1,380,000 | 2,760,000 |
1920 * 1080 | 15 | 2,080,000 | 4,160,000 |
1920 * 1080 | 30 | 3,150,000 | 6,300,000 |
Sample request
Content-type
:application/json;charset=utf-8
The request example of StartRecord
is as follows:
{
"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"
}
}