All Products
Search
Document Center

ApsaraVideo Live:StartLiveMPUTask

Last Updated:Jan 23, 2026

Creates a stream mixing and transcoding task.

Operation description

By default, each application ID supports a maximum of 200 single-stream ingest tasks and 40 stream mixing and transcoding tasks. To increase the quota, submit a ticket.

Stream mixing task lifecycle

Start

  • When a streamer starts streaming for the first time, you can call StartLiveMPUTask to start a bypass task.

    • If no users are in the channel, a "channel does not exist" error is returned.

    • The bypass stream is output only when a user starts stream ingest. If the user in a single-stream task does not ingest a stream, the bypass stream cannot be played.

    • For a stream mixing task, at least one user must be ingesting a stream for the bypass stream to be playable. The layout area for users who are not ingesting streams shows a black screen.

  • You can record the bypass task status, task type, and task parameters on your business server.

    • Task status: Started, Stopped.

    • Task type: Single-stream, Stream mixing.

    • Task parameters: The latest input parameters. For example, after a successful call to UpdateLiveMPUTask, record the latest task parameters.

  • In co-streaming or PK scenarios, if a task has been updated to a stream mixing task and the streamer unexpectedly leaves and then rejoins the channel, your business server can call StartLiveMPUTask to restart the stream mixing task based on the saved task type and parameters.

    • If the system has not automatically cleared the task before you start it, the task starts successfully.

    • If the system has not yet cleared the task, a Task already exists error code is returned.

End

  • When a streamer leaves the channel, call StopLiveMPUTask to stop the bypass task.

  • If all users in the task leave the channel and StopLiveMPUTask is not called, the system automatically stops the bypass task after 2 minutes.

QPS limits

The queries per second (QPS) limit for a single user for this API is 500 calls/second. If you exceed this limit, API calls are throttled. This may affect your business. We recommend that you call this API reasonably.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

live:StartLiveMPUTask

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

AppId

string

Yes

The application ID. Only one ID is supported. It can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-). The maximum length is 64 characters.

yourAppId

ChannelId

string

Yes

The channel ID. Only one ID is supported. It can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-). The maximum length is 64 characters.

yourChannelId

TaskId

string

Yes

The task ID. Only one ID is supported. It can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-). The maximum length is 55 characters. This ID is the unique identifier for the bypass ingest task. If a task with the same ID still exists and has not been cleared when you start a new task, `InvalidParam` is returned.

yourTaskId

MixMode

string

Yes

The stream mixing mode. Valid values:

  • 0: Single-stream ingest. The original single stream is ingested without stream mixing or transcoding. You do not need to configure stream mixing and transcoding parameters.

  • 1 (default): Stream mixing and transcoding.

0

StreamURL

string

No

The live ingest URL. Only the RTMP protocol is supported. Only one URL is supported. The maximum length is 2048 characters. For information about how to generate the URL, see Ingest URLs and playback URLs.

Note
  • For domain names with hotlink protection enabled, the ingest URL must include an access token.

  • Do not use the same StreamURL in different tasks at the same time.

  • Do not use the same StreamURL within 10 seconds after a task stops.

rtmp://example.com/live/stream

MultiStreamURL

array<object>

No

The parameters for ingesting to multiple URLs. You can specify multiple live ingest URLs.

Note

When you set the ingest URL for a task, you must configure either the StreamURL parameter or the MultiStreamURL parameter, but not both.

object

No

URL

string

No

The live ingest URL. Only the RTMP protocol is supported. The maximum length is 2048 characters. For information about how to generate the URL, see Ingest URLs and playback URLs.

rtmp://example.com/live/stream****

IsAliCdn

boolean

No

Specifies whether to ingest the stream to Alibaba Cloud CDN.

  • false: Ingest to a non-Alibaba Cloud CDN.

  • true: Ingest to Alibaba Cloud CDN.

Note

The default value is false.

false

Region

string

No

The region where the stream mixing service is located. Valid values:

  • CN-Shanghai: Shanghai.

  • AP-Singapore(default): Singapore.

  • EMAA-Saudi: Saudi Arabia.

CN-Shanghai

MaxIdleTime

string

No

The idle timeout period. Unit: seconds. The value must be in the range of [10, 86400].

Note

If you set this parameter, the task is automatically stopped when it has been idle for a period longer than MaxIdleTime. If you do not set this parameter, the task is stopped immediately after the channel is closed.

10

SingleSubParams

object

No

The parameters for single-stream ingest. This parameter is required when MixMode is set to 0. Do not set this parameter for stream mixing and transcoding.

SourceType

string

No

The type of video input stream in single-stream ingest mode. This parameter is valid only for video streams (StreamType=2). Valid values:

  • camera (default): Camera stream.

  • shareScreen: Screen sharing stream.

camera

StreamType

string

No

The type of stream to ingest in single-stream ingest mode. Valid values:

  • 0 (default): Ingest the original stream.

  • 1: Ingest only the audio stream.

  • 2: Ingest only the video stream.

0

UserId

string

Yes

The ID of the user whose stream is ingested. Only one stream can be ingested at a time.

yourSubUserId

TranscodeParams

object

No

The parameters for stream mixing and transcoding. This parameter is required when MixMode is set to 1. Do not set this parameter for single-stream ingest.

Background

object

No

The global background image for the mixed stream.

RenderMode

string

No

The display mode of the output video. Valid values:

  • 0: Scale and display a black background.

  • 1 (default): Clip.

1

URL

string

No

The URL of the global background image. The maximum length is 2048 characters.

yourImageUrl

EncodeParams

object

No

The encoding parameters for the output stream.

AudioOnly

string

No

Specifies whether the stream is audio-only. Valid values:

  • true: Audio-only. You only need to set audio-related parameters.

  • false (default): Not audio-only. All parameters except VideoCodec and EnhancedParam must be specified.

false

AudioBitrate

string

No

The audio bitrate. Unit: kbps. The value must be in the range of [8, 500].

128

AudioChannels

string

No

The number of audio channels. Valid values: 1, 2.

2

AudioSampleRate

string

No

The audio sampling rate. Unit: Hz. Valid values: 8000, 16000, 32000, 44100, 48000.

44100

VideoCodec

string

No

The video encoding format. Valid values:

  • H.264 (default).

  • H.265.

H.264

VideoBitrate

string

No

The video bitrate. Unit: kbps. The value must be in the range of [1, 10000].

3500

VideoFramerate

string

No

The video frame rate. Unit: fps. The value must be in the range of [1, 60].

25

VideoGop

string

No

The video GOP size. The value must be in the range of [1, 60].

20

VideoHeight

string

No

The video height. Unit: pixels. The value must be in the range of [0, 1920].

1000

VideoWidth

string

No

The video width. Unit: pixels. The value must be in the range of [0, 1920].

1920

EnhancedParam

string

No

The enhanced encoding parameters. This is a JSON string. The supported optional configurations include `profile` and `preset`.

  • `profile`: The encoding profile. If the video encoding format is H.264, valid values for `profile` include "baseline", "main", and "high". If the video encoding format is H.265, the valid value for `profile` is "main".

  • `preset`: Balances encoding speed and quality. Valid values for `preset` include "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", and "placebo". Each value represents a strategy for balancing encoding speed and output video quality, from "ultrafast" (fastest encoding speed) to "placebo" (highest quality, slowest encoding speed).

Note

For example, "superfast" is mainly used for real-time communication. If you are not an expert in encoders, do not set this option.

{"profile": "high", "preset": "veryfast"}

Layout

object

No

The video layout information.

Note

For video transcoding, you must specify the video layout information, including coordinates (X, Y), pane dimensions (Width, Height), and stacking order (ZOrder). For audio-only transcoding, do not specify video layout information.

UserPanes

array<object>

No

The information about user panes in the mixed stream.

array<object>

No

The information about user panes in the mixed stream.

UserInfo

object

No

The information about the user corresponding to this pane. If you do not set this parameter, the system automatically fills it based on the order in which streamers join the channel.

Note
  • If you specify user information, that user must already be configured in the `TranscodeParams.UserInfos` parameter.

  • This parameter is valid only for original streams and video streams.

SourceType

string

No

The type of video input stream in stream mixing and transcoding mode. This parameter is valid only for video streams (StreamType=2). Valid values:

  • camera (default): Camera stream.

  • shareScreen: Screen sharing stream.

camera

ChannelId

string

No

The ID of the channel where the user is located. You do not need to set this parameter for users in the same channel. For cross-channel stream mixing, set this parameter.

yourChannelId

UserId

string

No

The user ID.

yourSubUserId

Height

string

No

The height of the pane, as a normalized percentage.

0.2632

Width

string

No

The width of the pane, as a normalized percentage.

0.3564

X

string

No

The X-coordinate, as a normalized percentage.

0.2456

Y

string

No

The Y-coordinate, as a normalized percentage.

0.3789

ZOrder

string

No

The stacking order. 0 is the bottom layer. Layer 1 is on top of layer 0, and so on.

0

BackgroundImageUrl

string

No

The URL of the background image for the video pane. The maximum length is 2048 characters. When a user turns off their camera or has not joined the channel, this image is displayed in their layout position.

yourImageUrl

RenderMode

string

No

The display mode of the output video pane. Valid values:

  • 0: Scale and display a black background.

  • 1 (default): Clip.

1

UserInfos

array<object>

No

The information about the users to subscribe to for stream mixing. If you do not specify users, all users are included in the mixed stream.

object

No

The user information for stream mixing.

SourceType

string

No

The type of video input stream to subscribe to for stream mixing. This parameter is valid only for video streams (StreamType=2). Valid values:

  • camera (default): Camera stream.

  • shareScreen: Screen sharing stream.

camera

StreamType

string

No

The type of stream to subscribe to for stream mixing. Valid values:

  • 0 (default): Ingest the original stream.

  • 1: Ingest only the audio stream.

  • 2: Ingest only the video stream.

0

ChannelId

string

No

The ID of the channel where the subscribed user is located. You do not need to set this parameter for users in the same channel. For cross-channel stream mixing, set this parameter.

yourChannelId

UserId

string

Yes

The ID of the user to subscribe to for stream mixing.

yourSubUserId

SeiParams

object

No

The SEI configuration parameters.

LayoutVolume

object

No

The layout and volume SEI. The content of this parameter can be empty, which means the default layout and volume SEI is carried.

FollowIdr

string

No

Specifies whether to ensure that SEI is carried when sending an IDR keyframe. Valid values:

  • 0: Does not ensure SEI is carried.

  • 1: Ensures SEI is carried.

0

Interval

string

No

The SEI sending interval. Unit: milliseconds. The value must be in the range of [1000, 5000].

1000

PassThrough

object

No

The pass-through SEI.

FollowIdr

string

No

Specifies whether to ensure that SEI is carried when sending an IDR keyframe. Valid values:

  • 0: Does not ensure SEI is carried.

  • 1: Ensures SEI is carried.

0

Interval

string

No

The SEI sending interval. Unit: milliseconds. The value must be in the range of [1000, 5000].

1000

PayloadContent

string

No

The payload content of the pass-through SEI.

yourPayloadContent

PayloadContentKey

string

No

The key corresponding to the payload content of the pass-through SEI. If not set, the default key is `udd`.

yourPayloadContentKey

PayloadType

string

No

The custom payload_type of the SEI message. The value must be in the range of 100-254. If not set, the default payload_type is 5.

100

Layout and volume SEI

ParameterDescription
canvasCanvas information. Parameters:
- w: Canvas width in pixels.
- h: Canvas height in pixels.
- bgnd: Canvas background color, as a hexadecimal integer in RGB format.







streamVideo stream information. Parameters:
- uid: User ID of the streamer.
- paneid: Pane ID of the region, in the range of [0, 8].
- zorder: Stacking order of the region, in the range of [0, 99].
- x: X-coordinate of the region on the canvas, as a normalized percentage.
- y: Y-coordinate of the region on the canvas, as a normalized percentage.
- w: Width of the region, as a normalized percentage.
- h: Height of the region, as a normalized percentage.
- type: Type of video stream in the region. 0: Camera. 1: Screen sharing.
- status: Status of the video stream in the region. 0: Not yet pulled. 1: Pulled.
- muted: Mute status of the streamer. 0: Not muted. 1: Muted. In a PK scenario, if streamer A mutes streamer B, the `muted` field for streamer B shows the muted status.
- vol: Volume of the streamer in decibels, in the range of [0, 255].
- vad: Voice activity detection. The value is in the range of [0, 150]. 150 indicates that voice is detected. A value other than 150 indicates the trail-off time from voice to silence.


































tsThe operating system timestamp when this information was generated, in milliseconds.
verThe SEI format version, such as 1.0.0.20220915.
uddA custom scenario-based event sent through the `PassThrough` parameter. The content is specified by the `PayloadContent` parameter.
Note

When a user pulls an ingested stream, the streaming media data contains SEI information. You can use this feature to pass custom information. SEI information can be retrieved from the video frame data during video stream decoding. For the specific format, see the `PassThrough` parameter.

Example for a co-streaming scenario:

If there is only one streamer, the `stream` collection in the SEI information that the viewer receives contains information for only one member. If the streamer is in a co-streaming or PK session, the `stream` collection contains information for multiple members. For example, when streamer `streamer111` is streaming alone, the SEI frame format that the viewer receives is as follows:
{"canvas":{"w":1920,"h":1080,"bgnd":0},"stream":[{"uid":"streamer111","paneid":-1,"zorder":0,"x":0,"y":0,"w":0,"h":0,"type":0,"status":1,"muted":0,"vol":0,"vad":0}],"ver":"1.0.0.20220915","ts":1697696105170} When streamer `streamer111` is co-streaming with viewer `viewer222`, the SEI frame format that the viewer receives is as follows:
{"canvas":{"w":1920,"h":1080,"bgnd":0},"stream":[{"uid":"streamer111","paneid":0,"zorder":1,"x":0,"y":0.25,"w":0.5,"h":0.5,"type":0,"status":1,"muted":0,"vol":1,"vad":119},{"uid":"viewer222","paneid":1,"zorder":1,"x":0.5018382,"y":0.25,"w":0.5,"h":0.5,"type":0,"status":1,"muted":0,"vol":60,"vad":123}],"ver":"1.0.0.20220915","ts":1697696106230} By checking the number of elements in the `stream` array, you can determine whether the live layout has changed. If the `stream` array has one element, a single streamer is ingesting a stream. If the `stream` array has more than one element, the streamer is in a co-streaming or PK session. The layout information for each member indicates their specific position in the mixed stream layout.




Pass-through SEI

  • To use custom SEI, you can call the StartLiveMPUTask command to start a stream mixing and ingest task and specify `PayloadContent` in the `PassThrough` parameter. You can also call the UpdateLiveMPUTask command to update the task and specify `PayloadContent` in the `PassThrough` parameter.

  • Custom SEI can be sent periodically. You can set the period using the `Interval` parameter in `PassThrough`. The unit is milliseconds.

  • Custom SEI can also be sent with keyframes. You can set this using the `FollowIdr` parameter in `PassThrough`.
    • You can send SEI both periodically and with keyframes. For example, `Interval:1000` and `FollowIdr: 1` means that custom SEI is sent every 1000 ms and also with every keyframe.

    • If you do not set `Interval` or `FollowIdr`, the custom SEI is sent only once when the API is called.

For example, when streamer `streamer111` is streaming alone, you can call the UpdateLiveMPUTask command to send periodic SEI. In the `PassThrough` parameter, set `Interval` to 1000, `FollowIdr` to 0, and `PayloadContent` to "hello world". A custom SEI message is then sent every 1000 ms. The SEI frame format that the viewer receives is as follows:
{"canvas":{"w":1920,"h":1080,"bgnd":0},"stream":[{"uid":"streamer111","paneid":-1,"zorder":0,"x":0,"y":0,"w":0,"h":0,"type":0,"status":1,"muted":0,"vol":0,"vad":0}],"ver":"1.0.0.20220915","ts":1697696109876,"udd":"hello world"}

Cross-channel multi-user stream mixing

To mix streams from multiple streamers across multiple channels and ingest the mixed stream to the live streaming service, you must provide the UserID and ChannelID of the streamer who initiates the cross-channel call, along with the UserIDs of the other participants, as input parameters when you create the stream mixing task. See the following example: In a live PK scenario, streamer `userA` in channel `channelA` initiates a cross-channel PK with streamer `userB` in channel `channelB` using a client API. The mixed stream of both streamers is output to the viewers in channel `channelA`. In this case, the channel and user parameters for creating the stream mixing task are specified as follows:

  • ChannelID: Specify `channelA`.

  • UserInfos->UserId: Specify `userA` and `userB` respectively.

Note

Before you can create a cross-channel multi-user stream mixing task, a cross-channel call must be initiated through a client software development kit (SDK). If users in different channels are not in a call, you cannot create a cross-channel stream mixing task. For more information about how to initiate a cross-channel call, see Cross-channel subscription.

Response elements

Element

Type

Description

Example

object

The request ID.

RequestId

string

The request ID.

0F72851F-5DC1-1979-9B2C-450040316C3E

Examples

Success response

JSON format

{
  "RequestId": "0F72851F-5DC1-1979-9B2C-450040316C3E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParam %s. Parameter verification failed
400 InvalidAppId %s, please check and try again later. AppId is invalid, please check and try again.
400 MissingParam %s, please check and try again later. Parameter is missing, please check and try again.
500 InternalError InternalError
403 OperationDenied Your account has not enabled the Live service
403 Forbidden %s, please check and try again later. No permission, please check and try again.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.