All Products
Search
Document Center

ApsaraVideo Live:AddLiveAppRecordConfig

Last Updated:Dec 24, 2024

Configure APP recording, with output saved to OSS.

Operation description

The live stream recording feature allows you to record a live stream and stores the recordings in a specified location. You can view the recordings whenever you want to. Recordings that are stored in OSS support multiple formats, such as Transport Stream (TS), MP4, Flash Video (FLV), and Common Media Application Format (CMAF). You can use different recording policies, including automatic recording, on-demand recording, and manual recording. By calling this operation, you can configure the recording template. For more information about live stream recording, see Live stream recording.

QPS limit

You can call this operation up to 30 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
live:AddLiveAppRecordConfigcreate
*Domain
acs:cdn:*:{#accountId}:domain/{#DomainName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DomainNamestringYes

The main streaming domain.

example.com
AppNamestringYes

The name of the application to which the live stream belongs.

liveApp****
OssEndpointstringYes

The endpoint of the OSS bucket. To store live stream recordings in OSS, you need to create an OSS bucket in advance. For more information, see Configure OSS.

learn.developer.aliyundoc.com
OssBucketstringYes

The name of the OSS bucket where live streaming recording files are stored. To store recorded files in OSS, you need to create an OSS bucket in advance. For creation method, please refer to Configure OSS.

liveBucket****
StreamNamestringNo

Stream broadcast name.

teststream
StartTimestringNo

Start time of the recording. Format: yyyy-MM-ddTHH:mm:ssZ (UTC time).

Note The set time must be within 7 days of the actual streaming start time, and is only valid for stream-level recording (when StreamName is not empty).
2018-04-10T09:57:21Z
EndTimestringNo

Recording end time. Format: yyyy-MM-ddTHH:mm:ssZ (UTC time).

Note The difference between EndTime and StartTime should not exceed 7 days; if it does, it will be calculated as 7 days. This is only valid for stream-level recording (when StreamName is not empty).
2018-04-16T09:57:21Z
OnDemandintegerNo

On-demand recording. Valid values:

  • 0: Disabled.
  • 1: Via HTTP callback.
  • 2: Parse streaming parameters for on-demand recording.
  • 7: Default to not record, but can be manually controlled to start or stop recording through the RealTimeRecordCommand interface.
Note When OnDemand is set to 1, you need to first configure the OnDemandUrl via the AddLiveRecordNotifyConfig interface; otherwise, recording is disabled by default.
1
DelayTimeintegerNo

Duration for stream concatenation. If the live streaming interruption exceeds the set concatenation duration, a new file will be generated. The concatenation duration can be set between 15 to 21600 seconds.

180
RecordFormatarray<object>No

The recording details.

objectNo
SliceDurationintegerNo

The duration of a single segment. Unit: seconds.

Note This parameter takes effect only if you set the RecordFormat.N.Format parameter to m3u8 or cmaf.

If you do not specify this parameter, the default value 30 seconds is used. Valid values: 5 to 30.

30
SliceOssObjectPrefixstringNo

The naming format of a segment.

Note This parameter is required only if you set the RecordFormat.N.Format parameter to m3u8 or cmaf.
  • By default, the duration of a segment is 30 seconds. The segment name must be less than 256 bytes in length and can contain the {AppName}, {StreamName}, {UnixTimestamp}, and {Sequence} variables.
  • The segment name must contain the {UnixTimestamp} and {Sequence} variables.
record/{AppName}/{StreamName}/{UnixTimestamp}_{Sequence}
CycleDurationintegerNo

The recording cycle. Unit: seconds. If you do not specify this parameter, the default value 6 hours is used.

Note
  • If a live stream is interrupted during a recording cycle but is resumed within the interruption duration threshold, the stream is recorded in the same recording before and after the interruption.

  • If a live stream is interrupted for longer than the interruption duration threshold, a new recording is generated.

1
OssObjectPrefixstringNo

The naming format of a recording to store in OSS.

  • The name must be less than 256 bytes in length and can contain the {AppName}, {StreamName}, {Sequence}, {StartTime}, {EndTime}, {EscapedStartTime}, and {EscapedEndTime} variables.
  • The name must contain the {StartTime} and {EndTime} variables or the {EscapedStartTime} and {EscapedEndTime} variables.
record/{AppName}/{StreamName}/{Sequence}_{EscapedStartTime}_{EscapedEndTime}
FormatstringNo

The recording format. Supported formats include M3U8, FLV, MP4, and CMAF. Valid values:

Note You need to specify at lease one of the RecordFormat and TranscodeRecordFormat parameters. If you set this parameter to m3u8 or cmaf, you must also specify the RecordFormat.N.SliceOssObjectPrefix and RecordFormat.N.SliceDuration parameters.
  • m3u8
  • flv
  • mp4
  • cmaf
m3u8
TranscodeRecordFormatarray<object>No

The transcoded stream recording details.

objectNo
SliceDurationintegerNo

The duration of a single segment in a transcoded stream recording. Unit: seconds.

Note This parameter takes effect only if you set the TranscodeRecordFormat.N.Format parameter to m3u8 or cmaf.

If you do not specify this parameter, the default value 30 seconds is used. Valid values: 5 to 30.

30
SliceOssObjectPrefixstringNo

The naming format of a segment in a transcoded stream recording.

Note This parameter is required only if you set the TranscodeRecordFormat.N.Format parameter to m3u8 or cmaf.
  • By default, the duration of a segment is 30 seconds. The segment name must be less than 256 bytes in length and can contain the {AppName}, {StreamName}, {UnixTimestamp}, and {Sequence} variables.
  • The segment name must contain the {UnixTimestamp} and {Sequence} variables.
record/{AppName}/{StreamName}/{UnixTimestamp}_{Sequence}
CycleDurationintegerNo

The transcoded stream recording cycle. Unit: seconds. If you do not specify this parameter, the default value 6 hours is used.

21600
OssObjectPrefixstringNo

The naming format of a transcoded stream recording to store in OSS.

  • The name must be less than 256 bytes in length and can contain the {AppName}, {StreamName}, {Sequence}, {StartTime}, {EndTime}, {EscapedStartTime}, and {EscapedEndTime} variables.
  • The name must contain the {StartTime} and {EndTime} variables or the {EscapedStartTime} and {EscapedEndTime} variables.
record/{AppName}/{StreamName}/{Sequence}_{EscapedStartTime}_{EscapedEndTime}
FormatstringNo

The transcoded stream recording format. Supported formats include M3U8, FLV, MP4, and CMAF. Valid values:

Note If you set this parameter to m3u8 or cmaf, you must also specify the TranscodeRecordFormat.N.SliceOssObjectPrefix and TranscodeRecordFormat.N.SliceDuration parameters.
  • m3u8
  • flv
  • mp4
  • cmaf
m3u8
TranscodeTemplatesarrayNo

Transcoding stream recording template group.

stringNo
  • Transcoding stream recording transcoding templates, allowing multiple settings, up to 10.
  • When setting TranscodeRecordFormat.N.xxx configuration, at least one TranscodeTemplates must be set.
  • To record multiple or all transcoded streams, set TranscodeTemplates.1 to *****.
Note TranscodeTemplates does not allow inputting raw, which is a reserved identifier.
RepeatList signifies the N in TranscodeTemplates.N, interpretable as incrementally setting multiple configurations, e.g., TranscodeTemplates.1=sd, TranscodeTemplates.2=hd.
sd

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

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

Examples

Sample success responses

JSONformat

{
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F****"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidOssEndpoint.Malformed%s-
400InvalidOssBucket.MalformedSpecified parameter OssBucket is not valid.-
400InvalidOssBucket.NotFoundThe parameter OssBucket does not exist.-
400InvalidFormat.MalformedSpecified parameter Format is not valid.Invalid value of Format. Check whether the Format parameter that you specified is correct.
400InvalidCycleDuration.MalformedSpecified CycleDuration Format is not valid.Invalid format of CycleDuration. Check whether the format of the CycleDuration parameter is correct.
400InvalidSliceDuration.MalformedSpecified SliceDuration Format is not valid.-
400InvalidTemplateLength.MalformedSpecified record template length is not valid.-
400InvalidTemplate.ForbidRawTemplate named raw is Forbidden.-
400MissingTemplateTemplate is mandatory for this action.-
400MissingOssObjectPrefixOssObjectPrefix is mandatory for this action.-
400MissingSliceOssObjectPrefixSliceOssObjectPrefix is mandatory for this action.-
400InvalidOssObjectPrefix.MalformedSpecified parameter OssObjectPrefix is not valid.-
400InvalidSliceOssObjectPrefix.MalformedSpecified parameter SliceOssObjectPrefix is not valid.-
400ConfigAlreadyExistsConfig has already exist.-
400InvalidFormat.IllegalOperationSpecified parameter Format can not be multiple.-
400InvalidDelayTimeSpecified Delaytime is invalid.-
400Live2Vod.ConfigAlreadyExistsHad live2vod record config already.-
400InvalidStartTime.MalformedSpecified StartTime is malformed.-
400InvalidEndTime.MalformedSpecified EndTime is malformed.-
400InvalidEndTime.MismatchSpecified EndTime does not math the specified StartTime or current time.-
400InvalidStartTime.MismatchSpecified StartTime does not math the current time.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

Considerations:

  • ApsaraVideo Live supports triggered stream pulling. If the streaming URL for a domain name is used for playback, ApsaraVideo Live is automatically triggered to pull live streams. If no live streams are played, ApsaraVideo Live does not pull live streams from the origin. In this case, automatic recording, on-demand recording, and manual recording are also disabled.