As its core feature, ApsaraVideo VOD uses upload URLs and credentials to ensure the security of media asset upload. This topic describes the background information, usage notes, and limits of upload URLs and credentials. This topic also describes how to obtain and parse upload URLs and credentials.
An upload URL specifies the storage path of a media file. An upload credential authorizes you to upload a media file to ApsaraVideo VOD. ApsaraVideo VOD issues upload URLs and credentials to perform authorization and ensure security. This prevents unauthorized users from uploading media files. ApsaraVideo VOD generates media IDs when it issues upload URLs and credentials. Media IDs can be used for lifecycle management and media processing.
Media IDs include video IDs and image IDs. You can use media IDs for the following purposes:
Perform lifecycle management of media files after they are uploaded. After you upload a media file by using an upload URL and an upload credential, the initial status of the media file is Uploading. After a specific processing job for the media file is complete, the status of the media file changes to Uploaded, Transcoding, or Normal.
Process media files by using the transcoding, snapshot capture, video AI, and video editing features based on the media IDs.
An upload URL and an upload credential can be used only for a single media file, such as a single audio file, a single video, or a single image.
If you send repeated requests to obtain an upload URL and an upload credential for the same video, different upload URLs and credentials are issued.
Upload URLs are allocated by ApsaraVideo VOD. You cannot specify upload URLs.
All upload credentials have the same validity period of 3,000 seconds, which is equal to 50 minutes.
If you are uploading a large video file, an extended period of time is required to complete the upload. In this case, you must refresh the upload credential after it expires. The refreshed upload credential has the same validity period of 3,000 seconds and the upload URL remains unchanged.
For images and auxiliary media assets such as watermarks or subtitle files, you must obtain a new upload credential when the original one expires.
To upload videos, images, and auxiliary media assets, you must call different API operations to obtain upload URLs and credentials. You need to manually obtain upload URLs and credentials only when you use specific upload methods, as described in the following table.
In addition to uploading URLs and credentials, you can also use Security Token Service (STS) tokens to access ApsaraVideo VOD in specific scenarios. For more information about the differences between the two access methods, see Comparison between credentials and STS. The following differences exist between the two access methods:
If you use an upload credential to upload a media file, you can pass the AccessKey pair of your Alibaba Cloud account or a RAM user to construct the upload request.
If you use an STS token to upload a media file, you must pass the STS token to construct the upload request.
Whether you need to manually obtain upload URLs and credentials
Whether you need to manually parse upload URLs and credentials
The server upload SDKs provided by ApsaraVideo VOD support only the following programming languages:
You only need to deliver the obtained upload URLs and credentials to clients. You do not need to parse the upload URLs or credentials.
In this method, you need to use an ApsaraVideo VOD server operation SDK to obtain an upload URL and an upload credential. After that, you can initialize an Object Storage Service (OSS) SDK by using the obtained upload URL and credential and upload a media file.
Obtain upload URLs and credentials
ApsaraVideo VOD allows you to obtain upload URLs and credentials by using one of the following two methods:
Recommended. Obtain upload URLs and credentials by using ApsaraVideo VOD server operation SDKs to call API operations.
SDK sample code
C or C++
Commonly used operations
Parse upload URLs and credentials
If you upload media files by using OSS SDKs or OSS API, you must manually parse upload URLs and credentials. If you use other upload methods, you do not need to parse upload URLs or credentials, or care about how they are parsed.
You can decode the Base64-encoded values of the uploadAddress and uploadAuth parameters to obtain upload URLs and credentials. For more information, see Upload media files by using OSS SDKs.