All Products
Search
Document Center

Upload URLs and credentials

Last Updated: May 19, 2022

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.

Background information

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

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.

Limits

  • 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.

Usage notes

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.

Note

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.

Upload method

Whether you need to manually obtain upload URLs and credentials

Whether you need to manually parse upload URLs and credentials



Upload media files by using server upload SDKs

No

Notice

The server upload SDKs provided by ApsaraVideo VOD support only the following programming languages:

  • Java, Python, C, C++, and PHP

No

Upload media files by using client upload SDKs

Yes

Note

You only need to deliver the obtained upload URLs and credentials to clients. You do not need to parse the upload URLs or credentials.

No

Upload multiple media files at a time by using the URLs of source files

No

No

Upload media files by using OSS SDKs

Yes

Note

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.

Yes

Upload media files by using OSS API

Yes

Yes

Obtain upload URLs and credentials

ApsaraVideo VOD allows you to obtain upload URLs and credentials by using one of the following two methods:

Note

For more information about the sample code, click the upload method whose sample code you want to view in the table in the Usage notes section of this topic.

Programming language

SDK sample code

Java

Media upload by using ApsaraVideo VOD SDK for Java

Python

Media upload by using ApsaraVideo VOD SDK for Python

PHP

Media upload by using ApsaraVideo VOD SDK for PHP

.NET

Media upload by using ApsaraVideo VOD SDK for .NET

Node.js

Media upload by using ApsaraVideo VOD SDK for Node.js

Go

Media upload by using ApsaraVideo VOD SDK for Go

C or C++

Media upload by using ApsaraVideo VOD SDK for C or C++

  • Construct HTTP or HTTPS requests to obtain upload URLs and credentials. This method is complex because you need to sign your requests. For more information, see Request syntax and Media upload.

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.