全部产品
Search
文档中心

视频直播:UpdateLiveAppRecordConfig - 更新直播录制

更新时间:Dec 16, 2025

更新配置APP录制,输出内容保存到OSS中。

接口说明

先获取主播流域名,再调用本接口更新录制配置。

QPS 限制

本接口的单用户 QPS 限制为 30 次/秒。超过限制,API 调用会被限流,这可能会影响您的业务,请合理调用。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

live:UpdateLiveAppRecordConfig

*Domain

acs:cdn:*:{#accountId}:domain/{#DomainName}

请求参数

名称

类型

必填

描述

示例值

DomainName

string

主播流域名。

example.com

AppName

string

播流所属应用名称。

liveApp****

OssEndpoint

string

OSS 存储的 Endpoint 名称。

直播录制文件存储至 OSS,需提前创建 OSS Bucket,创建方法请参见配置 OSS

learn.developer.aliyundoc.com

StreamName

string

播流名称。

teststream

StartTime

string

录制开始时间。格式为:yyyy-MM-ddTHH:mm:ssZ(UTC 时间)。

说明

设置的时间必须是实际推流时间开始 7 天之内,只在流级别录制(StreamName 不为空)有效。

2018-04-10T09:57:21Z

EndTime

string

录制结束时间。格式为:yyyy-MM-ddTHH:mm:ssZ(UTC 时间)。

说明

EndTime 与 StartTime 相差不应超过 7 天,超过 7 天将按照 7 天计算。只在流级别录制(StreamName 不为空)有效。

2018-04-16T09:57:21Z

OnDemand

integer

按需录制。取值:

  • 0:关闭。

  • 1:通过 HTTP 回调方式。

  • 2:解析推流参数按需录制。

  • 7:默认不录制,可以通过 RealTimeRecordCommand 接口手动控制录制开启或停止。

说明

当 OnDemand 取值为 1 时,需要先通过 AddLiveRecordNotifyConfig 接口配置 OnDemandUrl,否则默认不录制。

1

DelayTime

integer

断流拼接时长。 直播断流时长超过设定的拼接时长后,将会生成新文件,断流拼接时长支持 15~21600 秒。

180

RecordFormat

array<object>

记录详情。

object

CycleDuration

integer

周期录制时长。单位:秒。不填则默认为 6 小时。

说明
  • 如果在一个录制周期内,直播流发生了断流,但是在断流拼接时长内,该直播流又正常推流,那么仍会在同一个录制文件中继续录制。

  • 一条直播流必须断流超过断流拼接时长,才会生成录制文件。

1

Format

string

格式。目前支持 M3U8、FLV、MP4、CMAF。取值:

重要 RecordFormat 和 TranscodeRecordFormat 两者至少需要设置一个。如果选择 m3u8 或 cmaf 格式,必须同时设置请求参数 RecordFormat.N.SliceOssObjectPrefix 和 RecordFormat.N.SliceDuration。
  • m3u8。

  • flv。

  • mp4。

  • cmaf。

m3u8

SliceDuration

integer

单个切片时长。单位:秒。

重要 当 RecordFormat.N.Format(格式)设为 m3u8 或 cmaf 时,本参数才有效。

不填则默认为 30 秒。取值范围:5s~30s。

30

TranscodeRecordFormat

array<object>

转码记录详情。

object

CycleDuration

integer

转码流录制周期录制时长。单位:秒。不填则默认为 6 小时。

21600

Format

string

转码流录制格式。目前支持 M3U8、FLV、MP4、CMAF。取值:

重要 这如果选择 m3u8 或 cmaf 格式,必须同时设置请求参数 TranscodeRecordFormat.N.SliceOssObjectPrefix 和 TranscodeRecordFormat.N.SliceDuration。

  • m3u8。

  • flv。

  • mp4。

  • cmaf。

m3u8

SliceDuration

integer

转码流录制单个切片时长,单位:秒。

重要 当 TranscodeRecordFormat.N.Format(转码流录制格式)设为 m3u8 或 cmaf 时,本参数才生效。

不填则默认为 30 秒。取值范围:5s~30s。

30

TranscodeTemplates

array

转码流录制的转码模板组。

string

  • 转码流录制的转码模板,可进行多个设置,最多为 10 个。

  • 当设置 TranscodeRecordFormat.N.xxx 配置时,至少需要设置一个 TranscodeTemplates。

  • 如需录制多个或全部的转码流,可设置 TranscodeTemplates.1 为*****即可。

说明

TranscodeTemplates 不允许传入raw,属于保留标识。
RepeatList 表示为 TranscodeTemplates.N 中的 N,可理解为递增进行多个设置,如: TranscodeTemplates.1=sd, TranscodeTemplates.2=hd。

sd

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

示例

正常返回示例

JSON格式

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

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidOssBucket.Malformed Specified parameter OssBucket is not valid. OSSBucket参数错误,请您确认该OSS BUCKET参数是否正确。
400 InvalidOssBucket.NotFound The parameter OssBucket does not exist.
400 InvalidFormat.Malformed Specified parameter Format is not valid. Format参数错误,请您确认该Format参数是否正确。
400 InvalidCycleDuration.Malformed Specified CycleDuration Format is not valid. CycleDuration参数格式错误,请您确认该CycleDuration参数格式是否正确。
400 InvalidSliceDuration.Malformed Specified SliceDuration Format is not valid.
400 InvalidTemplateLength.Malformed Specified record template length is not valid.
400 InvalidTemplate.ForbidRaw Template named raw is Forbidden.
400 MissingTemplate Template is mandatory for this action.
400 MissingOssObjectPrefix OssObjectPrefix is mandatory for this action.
400 MissingSliceOssObjectPrefix SliceOssObjectPrefix is mandatory for this action.
400 InvalidOssObjectPrefix.Malformed Specified parameter OssObjectPrefix is not valid.
400 InvalidSliceOssObjectPrefix.Malformed Specified parameter SliceOssObjectPrefix is not valid. SliceOssObjectPrefix参数错误,请您确认该SliceOssObjectPrefix参数是否正确。
400 ConfigAlreadyExists Config has already exist.
400 InvalidFormat.IllegalOperation Specified parameter Format can not be multiple.
400 InvalidDelayTime Specified Delaytime is invalid.
400 Live2Vod.ConfigAlreadyExists Had live2vod record config already.
400 InvalidStartTime.Malformed Specified StartTime is malformed.
400 InvalidEndTime.Malformed Specified EndTime is malformed.
400 InvalidEndTime.Mismatch Specified EndTime does not math the specified StartTime or current time.
400 InvalidStartTime.Mismatch Specified StartTime does not math the current time.
400 Forbidden Ram Permission is forbidden.
400 InvalidOssEndpoint.Malformed %s, please check and try again later. 无效的OssEndpoint,请检查后重试。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情