Domain name for API request: vod.intl.tencentcloudapi.com.
Live stream clipping refers to generating a new video (HLS format) in real time from a selected segment of the live stream portion during live streaming (when the live stream has not yet ended). Developers can share it immediately or store it for long-term preservation.
Tencent Cloud VOD supports two real-time editing modes:
Note:
Clipping persistence refers to saving the edited video as an independent video with its own FileId. Its lifecycle is not subject to any impact from the original live recorded video. Even if the original recorded video is deleted, the clipping result is not affected. You can also transcode it or publish it on WeChat for post-processing.
For example, a complete football match may have a live recording lasting over 2 hours. For cost savings, the customer can store the original video for 2 months, but can specify longer storage for the highlight reel from live stream clipping. You can also perform additional on-demand operations on the highlight reel separately, such as transcoding and publishing on WeChat. In this case, you can choose the live stream clipping and persistence solution.
The advantage of solidifying editing is that its lifecycle is independent of the original recorded video, and it can be managed separately and preserved long-term.
Note: If solidification is specified when editing, enable reception of editing solidification event notifications through the ModifyEventConfig API. After successful solidification, you will receive a PersistenceComplete event notification. Before receiving this event notification, you should not delete or archive the live video recording. Otherwise, playback of the generated video may be abnormal.
Non-solidified editing means that the result of editing (m3u8 file) shares the same TS segments with the live video recording. The generated video is not an independent and complete video (no independent FileId, only a playback URL), and its valid period is consistent with that of the full video of the live recording. Once the live recorded video is deleted, this clip will also become unplayable.
Editing is not solidified. Since the clipping result is not an independent video, it is not included in the video management of on-demand media assets. For example, the total number of videos in the console does not count this clip. It is also unable to separately target this clip for any video processing operation such as transcoding or publishing on WeChat.
The advantage of not solidifying editing is that the editing operation is relatively "lightweight" and will not generate additional storage overhead. However, its shortcoming is that the lifecycle is the same as the original recorded video, and it is unable to further transcode or perform other video processing.
A maximum of 100 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: LiveRealTimeClip. |
| Version | Yes | String | Common Params. The value used for this API: 2018-07-17. |
| Region | No | String | Common Params. This parameter is not required. |
| StreamId | Yes | String | Push stream live code. |
| StartTime | Yes | String | Start time of stream clipping. For the format, see ISO date format description. |
| EndTime | Yes | String | End time of stream clipping. For the format, see ISO date format description. |
| SubAppId | No | Integer | Video-on-demand (VOD) application ID. For customers who activate on-demand services from December 25, 2023, this field must be set to the app ID when accessing resources in on-demand applications (whether the default application or a newly created application). |
| IsPersistence | No | Integer | Whether solidified. 0: non-permanent, 1: solidified. Default non-permanent. |
| ExpireTime | No | String | Video storage expiry time after editing solidification. Format reference: ISO date format. Enter "9999-12-31T23:59:59Z" to indicate the video never expires. After expiry, the media file and its related resources (transcoding results, sprites, etc.) will be permanently deleted. Valid only when IsPersistence is 1. By default, videos solidified through editing never expire. |
| Procedure | No | String | Post-editing Solidified Video On-demand Task Flow Processing. For details, see upload specified task flow. Valid only when IsPersistence is 1. |
| ClassId | No | Integer | Category ID, used to categorize and manage media. You can create a category via the Create Category API to obtain the category ID. |
| SourceContext | No | String | Source context. This is used to pass user request information. The upload completion callback returns the value of this field. The maximum length is 250 characters. Valid only when IsPersistence is 1. |
| SessionContext | No | String | Session context. This is used to pass user request information. When the Procedure parameter is specified, the task flow status change callback returns the value of this field. The maximum length is 1000 characters. Valid only when IsPersistence is 1. |
| MetaDataRequired | No | Integer | Whether to return edited video metadata. 0: not required, 1: required. By default, does not need. |
| Host | No | String | The domain name added in VOD for time shift playback must be bound to a recording template and enabled for time-shift service in cloud streaming. If the first call of this interface is after 2021-01-01T00:00:00Z, this field is required. |
| StreamInfo | No | LiveRealTimeClipStreamInfo | Live stream information for editing: |
| ExtInfo | No | String | System reserved field. Do not fill in. |
| Parameter Name | Type | Description |
|---|---|---|
| Url | String | Edited Video Playback URL. |
| FileId | String | Unique identifier of media file for post-editing solidified video. |
| VodTaskId | String | Edited video task flow ID after solidification. |
| MetaData | MediaMetaData | Edited video metadata. |
| SegmentSet | Array of LiveRealTimeClipMediaSegmentInfo | Edited video clip information. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Trigger instant clipping for a live stream with the live stream code record-stream and domain name example.com. The start time is 2018-09-20T10:00:00Z, the end time is 2018-09-20T11:00:00Z, and no solidification is applied. Suppose the live stream was interrupted from 2018-09-20T10:30:00Z to 2018-09-20T10:40:00Z, with a duration of 10 minutes. Then the output parameter SegmentSet will contain two segment information entries, and the actual duration of the video after trimming is 50 minutes.
POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: LiveRealTimeClip
<Common request parameters>
{
"Host": "example.com",
"EndTime": "2018-09-20T11:00:00Z",
"StartTime": "2018-09-20T10:00:00Z",
"StreamId": "record-stream"
}
{
"Response": {
"Url": "http://example.com/playlist.m3u8",
"FileId": "",
"VodTaskId": "",
"MetaData": null,
"SegmentSet": [
{
"StartTime": "2018-09-20T10:00:00Z",
"EndTime": "2018-09-20T10:30:00Z"
},
{
"StartTime": "2018-09-20T10:40:00Z",
"EndTime": "2018-09-20T11:00:00Z"
}
],
"RequestId": "6ca31e3a-6b8e-xxxx-9256-fdc700064ef3"
}
}
This example shows you how to trigger instant clipping for a live stream with the live stream code record-stream and domain name example.com, with a start time of 2018-09-20T12:00:00Z and an end time of 2018-09-20T13:00:00Z, and then process it for persistence and task flow initiation.
POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: LiveRealTimeClip
<Common request parameters>
{
"IsPersistence": 1,
"Host": "example.com",
"StartTime": "2018-09-20T12:00:00Z",
"StreamId": "record-stream",
"EndTime": "2018-09-20T13:00:00Z",
"Procedure": "SomeProcedure"
}
{
"Response": {
"Url": "http://example.com/playlist.m3u8",
"FileId": "5285890xxxxxx199336",
"VodTaskId": "125xxxx65-procedurev2-bffb15f07530b57bc1aabb01fac74bca",
"MetaData": null,
"SegmentSet": [
{
"StartTime": "2018-09-20T12:00:00Z",
"EndTime": "2018-09-20T13:00:00Z"
}
],
"RequestId": "6ca31e3a-6b8e-xxxx-9256-fdc700064ef3"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation | Operation failed. |
| InternalError | Internal error. |
| InvalidParameterValue | Parameter value error. |
| InvalidParameterValue.ClipDuration | Parameter value error: The cropping time period is too long. |
| InvalidParameterValue.EndTime | Parameter value error: EndTime is invalid. |
| InvalidParameterValue.ExpireTime | Parameter value error: Incorrect ExpireTime format. |
| InvalidParameterValue.StartTime | Parameter value error: StartTime is invalid. |
| InvalidParameterValue.StreamIdInvalid | Parameter value error: invalid StreamId. |
| UnauthorizedOperation | Unauthorized operation. |
| UnsupportedOperation | The operation is not supported. |
文档反馈