Updated on 2026-01-16 GMT+08:00

Updating a Video

Function

After a media asset is created, you can upload a thumbnail, update the video file, or update the existing thumbnail.

If the video file is updated, call the API for confirming media asset upload to notify VOD.

If the thumbnail is updated or uploaded, you do not need to notify VOD.

You can upload an updated video by part. For details, see Example 2: Uploading a Media File Greater Than 20 MB by Part.

Constraints

The video update API can only be used to update media assets that fail to be downloaded or uploaded, or whose uploads have been canceled.

Rules for configuring parameters in the request body:

  • Configure at least one of the following parameters: video_name, cover_type, and subtitles.

  • To update a video, video_name and video_type must be specified.

  • To update a thumbnail, cover_type is mandatory and cannot be left empty. If cover_id is specified, the value must be 0.

  • To upload a subtitle file, the id, type, and language of subtitles must be specified.

If the parameters are not specified according to the preceding requirements, the API may return an abnormal response.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

URI

PUT /v1.0/{project_id}/asset

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when a request is sent. This parameter is mandatory for AK/SK authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

asset_id

Yes

String

Media asset ID assigned by VOD. It can only be queried but cannot be modified.

video_md5

No

String

MD5 value of the video file. You are advised to refer to the example of uploading and updating media files in "Generating an MD5 Value" in the appendix of API Reference.

video_name

No

String

Video file name.

The file name extension is optional.

video_type

No

String

Video file type.

The value can be MP4, TS, MOV, MXF, MPG, FLV, WMV, AVI, M4V, F4V, MPEG, 3GP, ASF, or MKV.

cover_id

No

Integer

Thumbnail ID.

Value range: [0, 7]

Currently, only one thumbnail is supported. The value can only be 0.

cover_type

No

String

Thumbnail image format.

The options include:

  • JPG

  • PNG

cover_md5

No

String

MD5 value of the thumbnail file.

subtitles

No

Array of Subtitle objects

Subtitle file information.

Table 4 Subtitle

Parameter

Mandatory

Type

Description

id

Yes

Integer

Subtitle ID.

Value range: [1, 16]

type

Yes

String

Subtitle file format. Currently, only SRT and VTT are supported.

language

Yes

String

Subtitle language.

name

No

String

Subtitle file name.

md5

No

String

MD5 value of the subtitle file.

description

No

String

Subtitle description.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

asset_id

String

Media asset ID assigned by VOD. It can only be queried but cannot be modified.

video_upload_url

String

URL for uploading videos.

It is used to upload a video file (≤ 20 MB) from the client. The URL contains temporary authorization information. If the file size is greater than 20 MB, the file needs to be uploaded by part.

NOTE:
You can use PUT requests to upload video files to video_upload_url. Configure Content-Type according to the type of the video file to be uploaded. The value is in the format of video/video format, for example, video/mp4.

cover_upload_url

String

URL for uploading thumbnail files.

NOTE:
You can use PUT requests to upload thumbnail images to cover_upload_url. Configure Content-Type according to the type of the thumbnail file to be uploaded. The value is in the format of image/image format, for example, image/png.

subtitle_upload_urls

Array of strings

URL for uploading subtitles.

NOTE:
You can use PUT requests to upload subtitle files to subtitle_upload_urls. Configure Content-Type according to the type of the subtitle file to be uploaded. For example, the value can be application/octet-stream.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

This example updates a media asset.

PUT https://{endpoint}/v1.0/{project_id}/asset

Content-Type: application/json
{
  "asset_id": "f488337c31c8e4622f1590735b134c65",
  "cover_id": "0",
  "cover_type": "JPG",
  "subtitles": [
    {
      "id": 1,
      "language": "CN",
      "type": "SRT",
      "md5": "SqcyFjJZoDZaP8oKIY6rgQ==",
      "description": "AAAAA"
    }
  ]
}

Example Responses

Status code: 200

Returned when the request succeeded.

{
  "asset_id" : "f488337c31c8e4622f1590735b134c65",
  "cover_upload_url" : "https://obs.cn-north-4.myhuaweicloud.com:443/obs-vod-1/%7Bproject_id%7D/f488337c31c8e4622f1590735b134c65/cover/Cover0.jpg?AWSAccessKeyId=CBN2J**********0RCSN&Expires=1518148410&Signature=kZYh0hEos2V**********AHGyXA%3D",
  "subtitle_upload_urls" : [ "https://obs-vod-1.obs.cn-north-4.myhuaweicloud.com:443/14ce1d4437164aba8b364ce15866154e/53a018d2dc53ca07eb5a07a839205c9d/subtitle/1.srt?AWSAccessKeyId=CBN2J**********0RCSN&Expires=1534760131&Signature=kZYh0hEos2V**********AHGyXA%3D" ]
}

Status code: 403

Returned when the request failed.

{
  "error_code" : "VOD.10062",
  "error_msg" : "Media asset or resource does not exist, please check."
}

Status Codes

Status Code

Description

200

Returned when the request succeeded.

403

Returned when the request failed.

Error Codes

See Error Codes.