All Products
Search
Document Center

ApsaraVideo Live:CreateLivePullToPush

Last Updated:Aug 05, 2025

Creates a stream pulling and relaying task.

Operation description

Important

The stream pulling and relaying feature is in public preview. You can use this feature free of charge. After the public preview ends, you will be charged for using this feature. The billing start date will be announced later.

  • You can call this operation to create a stream pulling and relaying task.

  • You can create tasks to pull live streams and video-on-demand (VOD) streams.

  • After a task is created, it starts at the specified start time. The task automatically stops and is deleted at the specified end time.

  • Ensure that the destination URL specified in the task is not used by any other task. Otherwise, stream ingest will fail because multiple tasks are attempting to relay streams to the same URL.

  • The callback events for stream pulling and relaying include callbacks for task status changes and task exits. For more information, see Stream pulling and relaying event callbacks.

QPS limit

The queries per second (QPS) limit for a single user is 10 calls per second. If this limit is exceeded, API calls are throttled, which may affect your business. We recommend that you call this operation only when necessary.

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 support 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:CreateLivePullToPush

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID.

cn-beijing

Region

string

Yes

The region where the task is started. Valid values:

  • ap-southeast-1 (Singapore)

  • ap-southeast-5 (Indonesia)

  • cn-beijing (Beijing)

  • cn-shanghai (Shanghai)

  • cn-shenzhen (Shenzhen)

cn-shanghai

TaskName

string

No

The name of the task. This parameter is used for fuzzy queries. The default value is an empty string ("").

test

StartTime

string

Yes

The start time of the task.

Note
  • The time is in the yyyy-MM-ddTHH:mm:ssZ format in UTC.

2024-08-26T10:30:00Z

EndTime

string

Yes

The end time of the task.

Note
  • The time is in the yyyy-MM-ddTHH:mm:ssZ format in UTC.

  • The value of EndTime must be later than the value of StartTime.

  • The value of EndTime must be later than the current time.

2024-08-27T14:30:00Z

SourceType

string

Yes

The type of the source stream. Valid values:

  • live: a live stream.

  • vod: an ApsaraVideo VOD resource.

  • url: a video file resource from a third-party source.

live

SourceProtocol

string

No

The protocol of the source stream.

Valid values:

  • rtmp

  • rtsp

  • srt

  • http-flv

  • flv

Note

This parameter is required only when the SourceType parameter is set to live. This parameter is invalid when the SourceType parameter is set to vod or url.

rtmp

SourceUrls

array

Yes

The list of source stream URLs.

Note
  • If SourceType is set to live, you can specify only one complete live streaming URL.

  • If SourceType is set to vod or url, you can specify up to 30 URLs.

  • If SourceType is set to live, the RTMP, RTSP, SRT, and HTTP-FLV protocols are supported.

  • If SourceType is set to vod, specify the media asset IDs of ApsaraVideo VOD.

  • If SourceType is set to url, the MP4 and HTTP-FLV protocols are supported.

testurls

string

No

The source stream URL.

Note
  • If SourceType is set to live, you can specify only one complete live streaming URL.

  • If SourceType is set to vod or url, you can specify up to 30 URLs.

  • If SourceType is set to live, the RTMP, RTSP, SRT, and HTTP-FLV protocols are supported.

  • If SourceType is set to vod, specify the media asset IDs of ApsaraVideo VOD.

  • If SourceType is set to url, the MP4 and HTTP-FLV protocols are supported.

rtmp://pulltest.****.aliyunlive.com/pulltest493/pulltest-w434

DstUrl

string

Yes

The destination URL for stream ingest.

Note
  • The RTMP protocol is supported.

  • The URL can be up to 2,000 characters in length.

rtmp://pushtest.********.aliyunlive.com/pulltest493/pulltest-w434

RepeatNumber

integer

No

The number of times the video is replayed after the playback is complete. Valid values:

  • 0 (default): The video is not replayed.

  • -1: The video is replayed in a loop.

  • Other positive integers: The number of times the video is replayed.

Note

This parameter is valid only for video-on-demand or third-party video streams.

0

FileIndex

integer

No

The index of the file from which to start the playback.

0

Offset

integer

No

The offset from which the video file starts to be read. Unit: seconds. Valid values: numbers greater than 0.

Note
  • This parameter specifies the offset from the first frame of the first video as the start position for reading.

  • This parameter is valid only for video-on-demand or third-party video streams.

2

CallbackUrl

string

No

The HTTP callback URL. By default, this parameter is empty.

Note
  • The URL is used to receive task-related callbacks.

  • The URL can be up to 2,000 characters in length.

  • If you do not specify this parameter, no callbacks are returned for task-related events.

https://callback*****.com

RetryInterval

integer

No

The retry interval. Unit: seconds. Valid values: 60 to 300. Default value: 60.

60

RetryCount

integer

No

The number of retries. The default value is 3.

3

Response parameters

Parameter

Type

Description

Example

object

The response.

RequestId

string

The request ID.

16A96B9A-F203-4EC5-8E43-CB92E68*****

RetCode

integer

The return code.

Note
  • A value of 0 indicates that the request was successful.

  • For information about other error codes, see the "Error codes" section of this topic.

0

Description

string

The error description.

OK

TaskId

string

The task ID.

fd245384-4067-4f91-9d75-9666a6bc9****

Examples

Success response

JSON format

{
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68*****",
  "RetCode": 0,
  "Description": "OK",
  "TaskId": "fd245384-4067-4f91-9d75-9666a6bc9****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter %s. Parameter error
400 InvalidParam.CodeIllegalDuration %s. The value of start time should be less than the value of end time .
400 CodeInvalidAliUid This aliuid does not have a live domain name. This aluid does not have a live domain name.
400 CodeNotEnoughResource Exceeded configuration limits or insufficient resources. Exceeded configuration limits or insufficient resources
400 CodeConfigAlreadyExists Code Config Already Exists
500 InternalError %s. error on the live liveapi server.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.