Cloud-based stream mixing

更新时间:
复制 MD 格式

ApsaraVideo Live offers a cloud-based stream mixing service. You can call OpenAPI operations to pull multiple video sources to a stream mixing server in the live center. The service uses powerful cloud processing to combine the sources into a single stream based on your layout. This combined stream is then delivered to viewers with edge acceleration. This topic describes the features and usage of cloud-based stream mixing.

Limits

  • Cloud-based stream mixing is a paid feature. It is currently in public preview and is free to use. After the public preview ends, standard fees will apply. The specific date will be announced later.

  • The maximum number of concurrent stream mixing tasks for each UID is 10. To increase this limit, submit a ticket. For more information, see Contact us.

  • For a list of live centers that support cloud-based stream mixing, see Service regions.

Scenarios

E-sports live streaming: During an e-sports event, you often need to show a close-up of a player in a specific area of the screen. You can push the main game stream and the player's camera feed to the live center to be mixed. Viewers then see the combined stream.

Monitoring scenarios: Surveillance cameras are usually installed in different locations. To display feeds from multiple cameras on a single screen in a control room, you can use cloud-based stream mixing. Push the streams from multiple cameras to the live center to be mixed and displayed.

Features

Feature

Description

Details

Multi-stream mixing

Push multiple video sources to the live center to be mixed into a single live stream.

  • Supports adding live streams that use the RTMP, FLV, or HTTP Live Streaming (HLS) protocols.

    Note

    Live streams that use the Alibaba Real-Time Communication (ARTC) protocol for Real-Time Streaming (RTS) are not supported.

  • Supports adding file streams.

  • Supports adding up to eight video sources.

Preset layouts

Provides preset layouts for the combined live stream to suit different scenarios.

Provides seven preset layouts. For more information, see Preset layout reference.

Custom layouts

You can add custom layouts for the combined live stream as needed.

Supports setting the number, size, and position of panes.

Stream mixing output

Outputs the mixed video sources as a single live stream.

Supports custom output domain names for stream mixing. You can use the domain name to watch the mixed content.

Query stream mixing tasks

Query the list of current stream mixing tasks and their configurations.

Supports real-time queries.

Merge updates

Update video sources or layouts during playback with seamless switching.

Does not support updating the output resolution or other similar settings.

Automatic deletion

Automatically delete stream mixing tasks.

Supports setting an automatic deletion time when you create a task. The task is automatically deleted at the specified time to conserve traffic. The default time is 7 days.

Important

You cannot modify a stream mix once it is created.

Stream mixing callbacks

Provides callbacks for the status of stream mixing tasks.

When you create a stream mixing task, the service can send a message to your webhook address indicating whether the task was created successfully. This lets you promptly receive the result.

Usage

ApsaraVideo Live lets you use the cloud-based stream mixing service by calling API operations. These operations include creating, updating, querying, and deleting stream mixing tasks. The API call sequence is as follows:

image

You can run these API operations directly in OpenAPI Explorer, which avoids the need to calculate signatures. After a successful call, OpenAPI Explorer automatically generates sample code for the software development kit (SDK). For SDKs in more languages, see ApsaraVideo Live SDKs.

For specific methods and parameters, see the following API documentation:

Scenario

Description

Interface

Create a stream mixing task (preset layout)

Create a stream mixing task using a preset layout template.

The following figure shows an example that uses the MixStreamLayout-2-1 template:压缩2-1

CreateMixStream

  • Pass the input source configuration (number, type, address, stacking order, size, position, and fill mode).

  • Pass the playback address for the mixed stream (domain name, AppName, and StreamName).

  • Pass the output resolution for the mixed stream.

Create a stream mixing task (custom layout)

Create a stream mixing task using a custom layout.

The following figure shows an example with two input streams:

CreateMixStream

  • Pass the input source configuration (number, type, address, stacking order, size, position, and fill mode).

  • Pass the playback address for the mixed stream (domain name, AppName, and StreamName).

  • Pass the output resolution for the mixed stream.

Updating a stream join

Update the video sources or layout of a stream mixing task.

UpdateMixStream

Pass the input source configuration (number, type, address, stacking order, size, position, and fill mode).

Note

The parameters for UpdateMixStream represent a complete configuration. When you call this operation, you must pass the entire updated configuration.

For example, if a task is mixing four video sources (A, B, C, and D) and you want to remove sources C and D, you must call UpdateMixStream and pass the configurations for only sources A and B.

Querying merged streams

Query the list of active stream mixing tasks and their configurations.

DescribeMixStreamList

  • Returns a list of active stream mixing tasks.

  • Returns the stream mixing configurations.

  • Returns the creation and modification times of the merged stream.

  • Returns the playback addresses for the mixed streams.

Delete a stream mixing task

When you no longer need a mixed stream, delete the task. Otherwise, the stream continues to be output.

DeleteMixStream

Preset layout reference

Cloud-based stream mixing provides seven preset layouts for different live streaming scenarios. To use a preset layout, pass the corresponding layout ID. No extra configuration is required.

Expand to view preset layouts

The layout parameters are described as follows:

Note
  • FillSizeNormalized: The size of the area that the layer element fills.

    [w,h]: The values of w and h range from 0 to 1. Both the width and height are normalized.

    For example, [0.2,0.3] indicates that the width is 20% of the total width and the height is 30% of the total height.

  • FillPositionNormalized: The normalized position of the area that the layer element fills.

    [x,y]: The values of x and y range from 0 to 1.

    For example, [0.1,0.1] indicates a horizontal offset of 10% and a vertical offset of 10% from the top-left corner.

Layout ID

Description

Corresponding pane ID

Style

MixStreamLayout-1-1

One video source. Layout parameters:

  • FillSizeNormalized: [1,1]

  • FillPositionNormalized: [0,0]

1-1 布局方格ID

压缩1-1

MixStreamLayout-2-1

Two video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [0.5,1]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.5,1]

  • FillPositionNormalized: [0.5,0]

MixStreamLayout-2-1-layout.png

MixStreamLayout-2-1-pic2.jpg

MixStreamLayout-2-2

Two video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [1,1]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.25,0.25]

  • FillPositionNormalized: [0.7,0.7]

2-2 ID

压缩2-2

MixStreamLayout-2-3

Two video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [1,1]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.25,0.25]

  • FillPositionNormalized: [0.7,0.05]

2-3 ID

压缩2-3

MixStreamLayout-3-1

Three video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [1,1]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0,0.5]

Source 3:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0.5,0.5]

3-1 ID

压缩3-1

MixStreamLayout-3-2

Three video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [1,1]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.3,0.3]

  • FillPositionNormalized: [0.1,0.6]

Source 3:

  • FillSizeNormalized: [0.3,0.3]

  • FillPositionNormalized: [0.6,0.6]

3-2 ID

压缩3-2

MixStreamLayout-4-1

Four video sources. Layout parameters:

Source 1:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0,0]

Source 2:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0.5,0]

Source 3:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0,0.5]

Source 4:

  • FillSizeNormalized: [0.5,0.5]

  • FillPositionNormalized: [0.5,0.5]

4-1 ID

压缩4-1

If these layouts do not meet your business needs, you can also create a custom layout. For more information, see Create a stream mixing task (custom layout).

FAQ

What is the difference between cloud-based stream mixing and local stream mixing?

In cloud-based stream mixing, clients push multiple streams to the live center to be mixed in the cloud. This process uses multiple input streams to produce one output stream. In local stream mixing, multiple streams are mixed into a single stream on a local device before being pushed to the live center. From the live center's perspective, this process uses one input stream to produce one output stream.

Note

Use cloud-based stream mixing when you need to mix streams from different clients. Use local stream mixing when you need to mix streams from different sources on a single client, such as a screen and a camera. For more information about local stream mixing, see Features of Push SDK for Android.