Domain name for API request: vod.intl.tencentcloudapi.com.
Crop an HLS video by time period to generate a new HLS video in real time. Developers can share it immediately or store it for long-term preservation.
Tencent Cloud VOD supports two editing modes:
-Edit and save: Save the edited video as an independent video with an independent FileId. This is suitable for long-term preservation of highlights.
This API is used to crop an m3u8 file based on input. Its minimum editing precision is one ts slice, so second-level or more precise editing precision cannot be achieved.
Editing solidification refers to saving an edited video as an independent video with its own FileId. Its lifecycle is not subject to the original input video. Even if the original input video is deleted, the clipping result is not impacted. You can also transcode it or publish it on WeChat.
For example, a complete football match raw video may last for 2 hours. For cost savings, a customer can store this video for 2 months, but can specify longer storage for the edited "highlights" video. You can also separately transcode the "highlights" video, publish it on WeChat, and perform other additional on-demand operations. In this case, you can choose the edit and solidify solution.
The advantage of edit solidification is that its lifecycle is independent of the original input video, allowing separate management and long-term preservation.
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 reduce the storage class of the original input video. Otherwise, playback of the generated video may be abnormal.
Editing is not solidified, which means the result of editing (m3u8 file) shares the same TS segments with the original input video. 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 original input full video. Once the original input video is deleted, the clip will also become unplayable.
Editing is not solidified. Since the clipping result is not an independent video, it is not included in video management of on-demand media assets (for example, the total number of videos in the console does not count this video clip), and no video processing operation such as transcoding or WeChat publishing can be performed on this video clip separately.
The advantage of non-solidified editing is that the editing operation is Relatively "lightweight" and will not generate additional storage overhead. However, its shortcoming is that the lifecycle is identical to the original recorded video, and it is unable to further perform video processing such as transcoding.
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: SimpleHlsClip. |
| Version | Yes | String | Common Params. The value used for this API: 2018-07-17. |
| Region | No | String | Common Params. This parameter is not required. |
| Url | Yes | String | Tencent Cloud VOD HLS video URL that needs to be cropped. |
| SubAppId | No | Integer | On-demand application ID. Customers who activate on-demand services from December 25, 2023 must fill in this field with the app ID when accessing resources in on-demand applications (whether the default application or a newly created application). |
| StartTimeOffset | No | Float | Crop start offset time, in seconds. Default: 0, which means crop from the beginning of the video. Negative numbers indicate how many seconds from the end of the video to start cropping. For example, -10 means start trimming from the 10th second from the end. |
| EndTimeOffset | No | Float | Crop end offset time, in seconds. Default: 0, which means crop to the end of the video. Negative numbers indicate how many seconds from the end of the video to end cropping. For example, -10 means end cropping at the last 10 seconds. |
| 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" for no expiry. After expiry, the media file and its related resources (transcoding result, sprites, etc.) will be permanently deleted. Valid only when IsPersistence is 1. By default, the video after editing solidification never expires. |
| 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 and obtain the category ID through the create category API. |
| 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. |
| OutputMediaType | No | String | Output video type. Valid values: |
| ExtInfo | No | String | Reserved field, used when special usage. Example value: "" |
| Parameter Name | Type | Description |
|---|---|---|
| Url | String | Trimmed video address. |
| MetaData | MediaMetaData | Cropped video metadata. Currently, the |
| FileId | String | Unique identifier of media file for post-editing solidified video. |
| TaskId | String | Edited video task flow ID after solidification. |
| 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. |
Trim from the 2nd second to the 10th second from the end
POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: SimpleHlsClip
<Common request parameters>
{
"Url": "http://example.com/xxxxx/aaaaaa/hhhh.m3u8",
"StartTimeOffset": 2,
"EndTimeOffset": 10
}
{
"Response": {
"Url": "http://example.com/xxxxx/aaaaaa/10_50.m3u8",
"FileId": "",
"TaskId": "",
"MetaData": {
"Size": 0,
"Container": "hls",
"Bitrate": 622014,
"Height": 480,
"Width": 640,
"Duration": 48,
"Rotate": 0,
"VideoStreamSet": [
{
"Bitrate": 592385,
"Height": 480,
"Width": 640,
"Codec": "h264",
"Fps": 25,
"CodecTag": "",
"DynamicRangeInfo": {
"Type": "",
"HDRType": ""
}
}
],
"AudioStreamSet": [
{
"Bitrate": 29629,
"SamplingRate": 44100,
"Codec": "aac"
}
],
"VideoDuration": 0,
"AudioDuration": 0,
"Md5": "Md5"
},
"RequestId": "12ae8d8e-dce3-4151-9d4b-5594145287e1"
}
}
Trim video from second 2 to second 10
POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: SimpleHlsClip
<Common request parameters>
{
"Url": "http://example.com/xxxxx/aaaaaa/hhh.m3u8",
"StartTimeOffset": 2,
"EndTimeOffset": 10
}
{
"Response": {
"Url": "http://example.com/xxxxx/aaaaaa/10_50.m3u8",
"FileId": "",
"TaskId": "",
"MetaData": {
"Size": 0,
"Container": "hls",
"Bitrate": 622014,
"Height": 480,
"Width": 640,
"Duration": 48,
"Rotate": 0,
"VideoStreamSet": [
{
"Bitrate": 592385,
"Height": 480,
"Width": 640,
"Codec": "h264",
"Fps": 25,
"CodecTag": "",
"DynamicRangeInfo": {
"Type": "",
"HDRType": ""
}
}
],
"AudioStreamSet": [
{
"Bitrate": 29629,
"SamplingRate": 44100,
"Codec": "aac"
}
],
"VideoDuration": 0,
"AudioDuration": 0,
"Md5": "Md5"
},
"RequestId": "12ae8d8e-dce3-4151-9d4b-5594145287e1"
}
}
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. |
| FailedOperation.InvalidVodUser | VOD service is not enabled. |
| InternalError | Internal error. |
| InvalidParameterValue | Parameter value error. |
| InvalidParameterValue.EndTimeOffset | Parameter error: invalid end time. |
| InvalidParameterValue.ExpireTime | Invalid parameter value: Incorrect ExpireTime format. |
| InvalidParameterValue.IsPersistence | Invalid parameter value: incorrectly fixed parameters. |
| InvalidParameterValue.OutputMediaType | Parameter value error: incorrect output media file type. |
| InvalidParameterValue.Precision | Invalid parameter value: incorrect precision parameter. |
| InvalidParameterValue.Procedure | Invalid parameter value: incorrect Procedure. |
| InvalidParameterValue.StartTimeOffset | Parameter error: invalid start time. |
| InvalidParameterValue.Url | Parameter error: invalid Url. |
| ResourceUnavailable.MasterPlaylist | Parameter error: M3u8 of MasterPlaylist is not supported. |
| UnauthorizedOperation | Unauthorized operation. |
文档反馈