CreateUploadVideo

Updated at:

Obtains the upload URL and credential for an audio or video file, and creates the media information. ApsaraVideo VOD issues the upload URL and credential to ensure authorization and security, prevent malicious uploads, and automatically create a media ID (MediaId), also known as a video ID (VideoId), for management. You can invoke this operation to obtain the required upload URL and credential, and create the audio and video information.

Operation description

  • Before you call this operation, make sure that you fully understand the billing methods and pricing of ApsaraVideo VOD. Uploading media assets to ApsaraVideo VOD incurs storage fees. For more information about billing, see Media asset storage billing. If you have enabled storage and transmission acceleration, uploading media assets to ApsaraVideo VOD also incurs upload acceleration fees. For more information about billing, see Storage and transmission acceleration billing. Storage fees are calculated from the time when the file is uploaded. Acceleration fees are calculated when you upload files after enabling the feature. Calling this operation alone does not incur fees.

  • Obtaining the upload URL and credential is the core foundation of ApsaraVideo VOD and a required step for every upload operation. ApsaraVideo VOD provides various upload methods, each with different requirements for obtaining the upload URL and credential. For more information, see Upload URLs and credentials.

  • This operation is used only to obtain the upload URL and credential and create basic media asset information. It does not upload files. For a complete example of uploading files by calling API operations, see Upload media asset files by using the ApsaraVideo VOD API.

  • This operation supports obtaining the upload URL and credential for both video and audio files. For more information, see Upload URLs and credentials.

  • If the video upload credential expires (the default validity period is 3,000 seconds), call the RefreshUploadVideo operation to obtain a new upload credential.

  • After the upload, you can configure a callback to receive upload event notifications or call the GetMezzanineInfo operation to check the file status in the response to determine whether the upload is successful.

  • The VideoId parameter returned by this operation can be used for media asset lifecycle management or media processing.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vod:CreateUploadVideo

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

CoverURL

string

No

The URL of the custom video thumbnail.

https://example.aliyundoc.com/image/D22F553TEST****.jpeg

Description

string

No

The description of the audio or video file displayed in ApsaraVideo VOD after the upload is complete.

  • The description can be up to 1,024 characters in length.

  • The description must be encoded in UTF-8.

UploadTest

FileName

string

Yes

The name of the audio or video source file to be uploaded.

  • The file name must contain an extension. The extension is not case-sensitive.

  • For supported extensions, see Upload overview.

D:\video_01.mp4

FileSize

integer

No

The size of the audio or video source file to be uploaded. Unit: bytes.

123

Title

string

Yes

The title of the audio or video file displayed in ApsaraVideo VOD after the upload is complete.

  • The title can be up to 128 characters in length.

  • The title must be encoded in UTF-8.

UploadTest

CateId

integer

No

The category ID. You can obtain the category ID by using one of the following methods:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Asset Management Configuration > Category Management to view the category ID.

  • When you create a category by calling the AddCategory operation, the category ID is the value of the CateId parameter in the response.

  • When you query categories by calling the GetCategories operation, the category ID is the value of the CateId parameter in the response.

100036****

Tags

string

No

The tags of the audio or video file.

  • You can specify up to 16 tags.

  • Separate multiple tags with commas (,).

  • Each tag can be up to 32 characters in length.

  • The tags must be encoded in UTF-8.

tag1,tag2

UserData

string

No

The custom settings. The value is a JSON string that supports settings such as message callback and upload acceleration. For more information, see UserData.

Note
  • To use the message callback feature, you must configure an HTTP callback URL and select the corresponding callback event types in the console. Otherwise, the callback settings do not take effect. If no callback URL is specified for subsequent tasks, notifications are pushed to this URL by default. For more information about how to configure HTTP callbacks in the console, see Callback settings.

  • To use the upload acceleration feature, you must submit an application to enable it. For more information, see Upload instructions.

{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}

TemplateGroupId

string

No

The ID of the transcoding template group. You can obtain the ID by using one of the following methods:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing Configuration > Transcoding Template Groups to view the ID of the transcoding template group.

  • When you create a transcoding template group by calling the Create a transcoding template group operation, the ID is the value of the TranscodeTemplateGroupId parameter in the response.

  • When you query transcoding template groups by calling the Query transcoding configuration list operation, the ID is the value of the TranscodeTemplateGroupId parameter in the response.

Note
  • If both WorkflowId and TemplateGroupId are specified, WorkflowId takes precedence.

  • If you do not specify this parameter, the default transcoding template group is used. If you specify this parameter, the specified transcoding template group is used.

  • If you set this parameter to the built-in No Transcoding template group, only the video upload completion event notification is generated after the audio or video file is uploaded. The single definition transcoding completion event notification is not generated.

  • The task triggered by this parameter is an asynchronous task. After the task is submitted, it is queued and executed asynchronously in the background.

  • To ensure normal playback, if you set this parameter to the built-in No Transcoding template group, only the following formats support direct playback without transcoding after the audio or video file is uploaded: MP4, FLV, MP3, M3U8, and WEBM. Other formats are only supported for storage (pay attention to the extension of FileName). If you use ApsaraVideo Player for playback, the version must be 3.1.0 or later.

405477f9e214d19ea2c7c854****

WorkflowId

string

No

The workflow ID. You can log on to the ApsaraVideo VOD console and choose Configuration Management > Media Processing Configuration > Workflows to view the workflow ID.

Note
  • If both WorkflowId and TemplateGroupId are specified, WorkflowId takes precedence. For more information, see Workflows.

  • The task triggered by this parameter is an asynchronous task. After the task is submitted, it is queued and executed asynchronously in the background.

613efff3887ec34af685714cc461****

StorageLocation

string

No

The storage address. You can obtain the storage address by using the following method: Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management Configuration > Storage Management to view the storage address.

Note

If you do not specify this parameter, the audio or video file is uploaded to the default storage address. If no default storage address is configured, the file is uploaded to the first storage address in the storage list. If you specify this parameter, the audio or video file is uploaded to the specified storage address.

out-****.oss-cn-shanghai.aliyuncs.com

AppId

string

No

The application ID. Default value: app-1000000. For more information, see Multi-application.

app-1000000

ReferenceId

string

No

The custom ID. The ID can be 6 to 64 characters in length and can contain only lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_). The ID must be unique within the user dimension.

123-123

EnableFirstFrameCover

boolean

No

Specifies whether to use the first frame of the video as the thumbnail.

GenerateThumbnail

boolean

No

Specifies whether to generate a thumbnail for the video.

Response elements

Element

Type

Description

Example

object

The response.

RequestId

string

The request ID.

25818875-5F78-4AF6-04D5-D7393642****

UploadAddress

string

The upload URL.

Note

The upload URL returned by the operation is Base64-encoded. When you call an SDK or API operation to upload the media asset, you must decode the URL before use. You only need to parse UploadAddress when you use the native OSS SDK or OSS API for upload.

eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****

VideoId

string

The audio or video ID. You can use this ID as a request parameter for media asset management, media processing, and media review operations.

93ab850b4f6f54b6e91d24d81d44****

UploadAuth

string

The upload credential.

Note

The upload credential returned by the operation is Base64-encoded. When you call an SDK or API operation to upload the media asset, you must decode the credential before use. You only need to parse UploadAuth when you use the native OSS SDK or OSS API for upload.

eyJFbmRwb2ludCI6Imm****

Examples

Success response

JSON format

{
  "RequestId": "25818875-5F78-4AF6-04D5-D7393642****",
  "UploadAddress": "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
  "VideoId": "93ab850b4f6f54b6e91d24d81d44****",
  "UploadAuth": "eyJFbmRwb2ludCI6Imm****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.