Starts a stream relay task.
Usage notes
You can call this operation to start a stream relay task. The following limits apply when you use the stream relay feature:
- The maximum number of concurrent stream relay tasks allowed is 20.
- If you do not enable transcoding, each accelerated domain name supports concurrent ingest of up to 20 live streams that are in original quality.
- If you enable transcoding, each accelerated domain name supports concurrent ingest of up to 10 live streams that are transcoded.
- After you enable the stream relay feature and configure URL signing for the ingest URL, the ingest URL cannot be accessed after the validity period elapses. For more information, see URL signing.
QPS limit
You can call this operation up to 10 times per second per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | StartMPUTask | The operation that you want to perform. Set the value to StartMPUTask. |
AppId | String | Yes | yourAppId | The ID of the application. You can specify only one application ID in each request. |
ChannelId | String | Yes | yourChannelId | The ID of the channel. You can specify only one channel ID. |
TaskId | String | Yes | yourTaskId | The ID of the task. You can specify only one task ID in each request. The ID can be up to 55 bytes in length and can contain letters, digits, underscores, and hyphens (-). Note The ID must be unique. |
TaskType | Integer | No | 0 | The type of media processing. Valid values:
|
MixMode | Integer | No | 0 | The stream mixing mode. Valid values:
Note
|
TaskProfile | String | No | Mixed_Audio | The task profile. For audio-only stream mixing, you must set this parameter to Mixed_Audio. In other cases, leave this parameter empty. |
MediaEncode | Integer | No | 2 | The encoding option. For more information, see the "Enumeration values of the MediaEncode parameter" section in this topic. |
SubSpecUsers.N | String | No | userID | The users whose tracks to which the task subscribes. By default, the task subscribes to the tracks of all users in the current channel. N is an integer that indicates the index of the user. Valid values of N: 1 to 16. Note The values of N must start from 1 and must be in consecutive ascending order. |
LayoutIds.N | Long | No | 1 | The layout ID. You can specify multiple layouts for a task. The system selects the layout based on the number of users in the channel. Valid values of N: 1 to 16. You can specify up to 16 layouts for a stream relay task. Note
|
UserPanes.N.Images.N.Display | Integer | No | 2 | Specifies whether to display the image. Valid values:
|
UserPanes.N.Images.N.Height | Float | No | 0.2456 | The height of the image. The value is normalized. |
UserPanes.N.Images.N.Url | String | No | https://www.example.com/image.jpg | The HTTP or HTTPS URL of the image. |
UserPanes.N.Images.N.Width | Float | No | 0.2456 | The width of the image. The value is normalized. |
UserPanes.N.Images.N.X | Float | No | 0.7576 | The x-coordinate of the image. The value is normalized. |
UserPanes.N.Images.N.Y | Float | No | 0.7576 | The y-coordinate of the image. The value is normalized. |
UserPanes.N.Images.N.ZOrder | Integer | No | 0 | The layer in which the image resides. A value of 0 indicates the bottom layer. A value of 1 indicates the upper layer of the bottom layer. By analogy, you can obtain the specific layer indicated by a specific value. |
UserPanes.N.PaneId | Integer | No | 2 | The pane ID. Valid values: 0 to 15. Note If no user with the specified pane ID is found, a default track is played in the pane. The default track is determined based on the order in which users join the channel. |
UserPanes.N.SegmentType | Integer | No | 0 | Specifies whether to segment human figures. Valid values:
|
UserPanes.N.SourceType | String | No | camera | The type of the track that is played in the pane. Valid values:
|
UserPanes.N.Texts.N.Alpha | Float | No | 0.0 | The transparency of the text bounding box and the text. A value of 0.0 indicates that the text bounding box and the text are transparent. A value of 1.0 indicates that the text bounding box and the text are opaque. |
UserPanes.N.Texts.N.BorderColor | Long | No | 0 | The color of the text outline, which is an RGB value. The following formula is used to calculate the RGB value: |
UserPanes.N.Texts.N.BorderWidth | Integer | No | 1 | The width of the text outline. Unit: pixel. Default value: 0. |
UserPanes.N.Texts.N.Box | Boolean | No | false | Specifies whether to display the text bounding box in the clock. Valid values:
|
UserPanes.N.Texts.N.BoxBorderWidth | Integer | No | 0 | The width of the text bounding box in the clock. Unit: pixel. Default value: 0. |
UserPanes.N.Texts.N.BoxColor | Long | No | 0 | The color of the text bounding box in the clock, which is an RGB value. The following formula is used to calculate the RGB value: |
UserPanes.N.Texts.N.FontColor | Integer | No | 0 | The font color of the text, which is an RGB value. The following formula is used to calculate the RGB value: |
UserPanes.N.Texts.N.FontSize | Integer | No | 1 | The font size of the text. Valid values: 0 to 72. |
UserPanes.N.Texts.N.FontType | Integer | No | 0 | The font type of the text. Valid values:
|
UserPanes.N.Texts.N.Text | String | No | text | The content of the text. |
UserPanes.N.Texts.N.X | Float | No | 0.7576 | The x-coordinate of the text. The value is normalized. |
UserPanes.N.Texts.N.Y | Float | No | 0.2456 | The y-coordinate of the text. The value is normalized. |
UserPanes.N.Texts.N.ZOrder | Integer | No | 0 | The layer in which the text resides. A value of 0 indicates the bottom layer. A value of 1 indicates the upper layer of the bottom layer. By analogy, you can obtain the specific layer indicated by a specific value. |
UserPanes.N.UserId | String | No | TestId | The ID of the user whose track is played in the pane. Valid values of N: 1 to 16. |
Backgrounds.N.Display | Integer | No | 1 | Specifies whether to display the background image. Valid values:
|
Backgrounds.N.Height | Float | No | 0.2456 | The height of the background image. The value is normalized. |
Backgrounds.N.Url | String | No | https://www.example.com/image.jpg | The HTTP or HTTPS URL of the background image. |
Backgrounds.N.Width | Float | No | 0.2456 | The width of the background image. The value is normalized. |
Backgrounds.N.X | Float | No | 0.7576 | The x-coordinate of the background image. The value is normalized. |
Backgrounds.N.Y | Float | No | 0.7576 | The y-coordinate of the background image. The value is normalized. |
Backgrounds.N.ZOrder | Integer | No | 0 | The layer in which the background image resides. A value of 0 indicates the bottom layer. A value of 1 indicates the upper layer of the bottom layer. By analogy, you can obtain the specific layer indicated by a specific value. |
Watermarks.N.Alpha | Float | No | 0.0 | The transparency of the watermark. A value of 0.0 indicates that the text bounding box and the text are transparent. A value of 1.0 indicates that the text bounding box and the text are opaque. |
Watermarks.N.Display | Integer | No | 0 | Specifies whether to display the watermark. Valid values:
|
Watermarks.N.Height | Float | No | 0.2456 | The height of the watermark. The value is normalized. |
Watermarks.N.Url | String | No | https://www.example.com/image.jpg | The HTTP or HTTPS URL of the watermark. |
Watermarks.N.Width | Float | No | 0.2456 | The width of the watermark. The value is normalized. |
Watermarks.N.X | Float | No | 0.7576 | The x-coordinate of the watermark. The value is normalized. |
Watermarks.N.Y | Float | No | 0.7576 | The y-coordinate of the watermark. The value is normalized. |
Watermarks.N.ZOrder | Integer | No | 0 | The layer in which the watermark resides. A value of 0 indicates the bottom layer. A value of 1 indicates the upper layer of the bottom layer. By analogy, you can obtain the specific layer indicated by a specific value. |
ClockWidgets.N.Alpha | Float | No | 0 | The transparency of the text bounding box and the text in the clock. A value of 0.0 indicates that the text bounding box and the text are transparent. A value of 1.0 indicates that the text bounding box and the text are opaque. |
ClockWidgets.N.BorderColor | Long | No | 0 | The color of the text outline in the clock, which is an RGB value. The following formula is used to calculate the RGB value: |
ClockWidgets.N.BorderWidth | Integer | No | 1 | The width of the text outline in the clock. Unit: pixels. Default value: 0. |
ClockWidgets.N.Box | Boolean | No | false | Specifies whether to display the text bounding box in the clock. Valid values:
|
ClockWidgets.N.BoxBorderWidth | Integer | No | 0 | The width of the text bounding box in the clock. Unit: pixel. Default value: 0. |
ClockWidgets.N.BoxColor | Long | No | 0 | The color of the text bounding box in the clock, which is an RGB value. The following formula is used to calculate the RGB value: |
ClockWidgets.N.FontColor | Integer | No | 0 | The font color of the clock, which is an RGB value. The following formula is used to calculate the RGB value: |
ClockWidgets.N.FontSize | Integer | No | 1 | The font size of the clock. Valid values: 0 to 72. |
ClockWidgets.N.FontType | Integer | No | 0 | The font type of the clock. Valid values:
|
ClockWidgets.N.X | Float | No | 0.7576 | The x-coordinate of the clock. The value is normalized. |
ClockWidgets.N.Y | Float | No | 0.7576 | The y-coordinate of the clock. The value is normalized. |
ClockWidgets.N.ZOrder | Integer | No | 0 | The layer in which the clock resides. A value of 0 indicates the bottom layer. A value of 1 indicates the upper layer of the bottom layer. By analogy, you can obtain the specific layer indicated by a specific value. |
StreamType | Integer | No | 0 | The stream to be relayed in single-stream relay mode. Valid values:
|
SourceType | String | No | camera | The video source in single-stream relay mode. Valid values:
|
StreamURL | String | No | rtmp://example.com/live/stream | The ingest URL. You can specify only one URL. For information about the generation rules of ingest URLs, see Ingest and streaming URLs. Note
|
PayloadType | String | No | 0 | The payload type. Valid values:
|
VadInterval | String | No | 86400 | The callback interval for speech excitation. |
EnhancedParam.EnablePortraitSegmentation | Boolean | No | false | Specifies whether to enable the human figure segmentation feature. This feature is in private preview. Valid values:
|
The parameter settings for stream relay in audio-only mode are similar to those in audio-and-video mode. The differences lie in the settings of the LayoutIds, MediaEncode, and TaskProfile parameters. The three parameters respectively specify the layout, encoding option, and task profile. Take note of the following rules when you configure stream relay in audio-only mode:
- LayoutIds: The value of this parameter is determined by TaskProfile. If TaskProfile is set to Mixed_Audio, the number of audio sources allowed is not limited.
- MediaEncode: You must set this parameter to 0.
Enumeration values of the MediaEncode parameter
ID |
Width |
Height |
Bitrate (Kbit/s) |
Frame rate (FPS) |
0 |
0 |
0 |
64 |
0 |
1 |
640 |
360 |
500 |
15 |
54 |
360 |
640 |
500 |
30 |
53 |
360 |
640 |
500 |
15 |
52 |
640 |
360 |
500 |
30 |
10 |
960 |
540 |
700 |
24 |
20 |
1280 |
720 |
1024 |
25 |
22 |
720 |
1280 |
1024 |
30 |
23 |
800 |
600 |
1024 |
30 |
30 |
1920 |
1080 |
2048 |
30 |
31 |
1080 |
1920 |
2048 |
30 |
24 |
750 |
780 |
1024 |
30 |
25 |
750 |
540 |
700 |
30 |
26 |
720 |
1280 |
2048 |
30 |
27 |
1280 |
720 |
2048 |
30 |
28 |
1280 |
720 |
3096 |
30 |
32 |
1024 |
768 |
1024 |
24 |
33 |
1280 |
960 |
1024 |
24 |
34 |
1024 |
768 |
2048 |
24 |
35 |
1280 |
960 |
2048 |
24 |
36 |
1280 |
720 |
1024 |
24 |
37 |
1280 |
720 |
2048 |
24 |
38 |
540 |
960 |
750 |
15 |
39 |
540 |
960 |
1500 |
30 |
40 |
1280 |
720 |
1200 |
15 |
41 |
720 |
1280 |
1200 |
15 |
42 |
720 |
1280 |
1500 |
15 |
43 |
540 |
960 |
1200 |
15 |
Response parameters
Parameter |
Type |
Example |
Description |
RequestId | String | 760bad53276431c499e30dc36f6b26be | The ID of the request. |
Examples
Sample requests
https://live.aliyuncs.com/?Action=StartMPUTask
&AppId=yourAppId
&ChannelId=yourChannelId
&TaskId=yourTaskId
&MediaEncode=2
&BackgroundColor=0
&LayoutIds.1=2
&UserPanes.1.PaneId=0
&UserPanes.1.UserId=TestId
&UserPanes.1.SourceType=camera
&StreamURL=rtmp://example.com/live/stream
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<StartMPUTaskResponse>
<RequestId>760bad53276431c499e30dc36f6b26be</RequestId>
</StartMPUTaskResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "760bad53276431c499e30dc36f6b26be"
}
Error codes
For a list of error codes, see Service error codes.