Registers media assets. Existing media files stored in your own OSS bucket that is connected to ApsaraVideo VOD must be registered to generate the associated data required by VOD before you can use VOD features such as transcoding and snapshotting.
Operation description
For audio and video files already stored in an OSS bucket connected to ApsaraVideo VOD, you must call this operation to generate the associated data required by VOD before you can initiate transcoding, snapshotting, AI processing, and other operations on these files by media ID.
You can register up to 10 OSS media files at a time, and all media files submitted in a single request must correspond to the same storage address.
For media files uploaded through VOD, if no transcoding template group ID is specified, the default template group is used for transcoding. In contrast, after media asset registration, transcoding is not automatically triggered if no transcoding template group ID is specified. If a transcoding template group ID is specified, transcoding is performed based on the specified template group.
If a media file is registered repeatedly, only the unique media ID associated with it is returned, and no other processing is performed.
Make sure that the media file you want to register has a valid file name extension. Otherwise, the registration fails.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vod:RegisterMedia |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegisterMetadatas |
string |
Yes |
The metadata of the media assets to register. The value is a JSON string. You can specify metadata for up to 10 media assets at a time. For more information about the parameter structure, see the RegisterMetadata table below. |
[{"FileURL":"https://****.oss-cn-shanghai.aliyuncs.com/video/test/video123.m3u8","Title":"VideoName"}] |
| TemplateGroupId |
string |
No |
The transcoding template group ID. You can obtain the ID by using one of the following methods:
Note
|
ca3a8f6e49c87b65806709586**** |
| UserData |
string |
No |
The custom settings. The value is a JSON string that supports settings such as message callbacks. For more information, see UserData. Note
This operation does not support callbacks. Even if you configure a message callback in this parameter, no callback message is generated after media asset registration is complete. When you subsequently initiate media processing such as transcoding or snapshotting on the registered media asset, if you specify a message callback in UserData at that time, that callback URL takes precedence. Otherwise, the callback URL specified in UserData during media asset registration is used. |
{"Extend":{"localId":"****","test":"www"}} |
| WorkflowId |
string |
No |
The workflow ID. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Processing > Workflow Management to view the workflow ID. Note
|
637adc2b7ba51a83d841606f8**** |
| EnableFirstFrameCover |
boolean |
No |
||
| GenerateThumbnail |
boolean |
No |
RegisterMetadata
Specifies the metadata of the media assets to register.
| Name | Type | Required | Description |
| FileURL | String | Yes | The URL of the source file. You can obtain this value by calling the GetMezzanineInfo operation. The URL cannot exceed 1024 bytes. The file name must be globally unique. If you add a file with the same name, it is associated with the unique media ID. The URL is in the format of the public endpoint of the OSS bucket + ObjectName (file name). |
| Title | String | Yes | The title. The title cannot exceed 128 bytes. UTF-8 encoded. |
| Description | String | No | The description. The description cannot exceed 1024 bytes. UTF-8 encoded. |
| Tags | String | No | The tags. Each tag cannot exceed 32 bytes. You can specify up to 16 tags. Separate multiple tags with commas (,). UTF-8 encoded. |
| CoverURL | String | No | The cover URL. The URL cannot exceed 1024 bytes. |
| CateId | Long | No | The category ID. You can obtain the ID by using one of the following methods: Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management > Category Management to view the category ID. Obtain the value of CateId from the response when you call the AddCategory operation. Obtain the value of CateId from the response when you call the GetCategories operation. |
| ReferenceId | String | No | The custom ID. Only lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_) are supported. The value must be 6 to 64 characters in length and must be unique for each user. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
14F43C5C-8033-448B-AD04F64E5098**** |
| FailedFileURLs |
array |
The list of file URLs that failed to be registered. |
|
|
string |
The list of file URLs that failed to be registered. |
["http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_03.mp4"] |
|
| RegisteredMediaList |
array<object> |
The list of media assets that are successfully registered, including both newly registered files and previously registered files. |
|
|
object |
The registration details. |
||
| NewRegister |
boolean |
Indicates whether the media asset is newly registered or repeatedly registered.
|
false |
| FileURL |
string |
The OSS file URL. |
http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_01.mp4 |
| MediaId |
string |
The VOD media ID. If the registered media file is an audio or video file, this value corresponds to the VideoId in ApsaraVideo VOD. |
d97af32828084d1896683b1aa38**** |
Examples
Success response
JSON format
{
"RequestId": "14F43C5C-8033-448B-AD04F64E5098****",
"FailedFileURLs": [
"[\"http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_03.mp4\"]"
],
"RegisteredMediaList": [
{
"NewRegister": false,
"FileURL": "http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_01.mp4",
"MediaId": "d97af32828084d1896683b1aa38****"
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.