You can upload media files stored on an application server to the bucket allocated by ApsaraVideo for VOD. This method applies to automatic upload of videos and migration of a large number of videos. You can also use this upload mode to upload media files stored on the Internet. In this case, you download the files to the application server and then upload them to the bucket allocated by ApsaraVideo for VOD.
The following figure shows the upload process.
- Register an Alibaba Cloud account, complete verification, and activate ApsaraVideo for VOD.
- Obtain an AccessKey to access ApsaraVideo for VOD. You can create an AccessKey for your Alibaba Cloud account on the Access Key Management page in the Alibaba Cloud console. Alternatively, you can create a RAM user in the RAM console and grant the user the permission (such as
AliyunVODFullAccess) to access ApsaraVideo for VOD. For more information, see RAM user access.
You can upload multiple types of media files (including videos, audio, images) that are stored on the application server or on the Internet. Hereinafter, media files stored on the application server are referred to as local media files, and media files stored on the Internet are referred to as network media files. You can perform the following operations:
- Upload a local audio or video file to ApsaraVideo for VOD. Multi-part upload is used by default. The maximum size of a single file that can be uploaded is 48.8 TB. Resumable upload is supported.
- Upload a network audio or video file to ApsaraVideo for VOD. After you specify a URL, the system automatically downloads the video from the URL and uploads it to ApsaraVideo for VOD. The maximum size of a single file that can be uploaded is 5 GB.
- Upload a local image file to ApsaraVideo for VOD. After you specify the path of a local image file, the system automatically uploads the image file to ApsaraVideo for VOD.
- Upload a network image file to ApsaraVideo for VOD. After you specify a URL, the system automatically downloads the image from the URL and uploads it to ApsaraVideo for VOD.
- View the upload progress. The default progress callback and custom progress callback are supported.
- Set other upload parameters. For more information about other upload settings, see media upload overview.
You need to deploy the upload script on your application server. You can integrate a server upload SDK or use the upload API to upload files.
ApsaraVideo for VOD provides server upload SDKs and demos. A server upload SDK has encapsulated the logic for obtaining the upload URL and credential. You do not need to implement this logic separately. You only need to specify the AccessKey (including the
AccessKey ID and
AccessKey Secret) and the URL of the file to be uploaded.
Currently, ApsaraVideo for VOD provides the following server upload SDKs:
If you are using a language that is not covered by the upload SDKs of ApsaraVideo for VOD, you can use the OSS native SDK to upload files. The procedure is as follows:
Access ApsaraVideo for VOD to obtain the upload URL and credential.
In this step, ApsaraVideo for VOD also creates media asset information and returns the media ID (such as VideoId and ImageId). Save the media ID properly, which will be used later. For example, you can play a video, manage a video, and use AI to process a video based on the video ID.
Parse the upload URL (UploadAddress) and upload credential (UploadAuth) to obtain the OSS upload URL and authorization information. For more information, see Parse the upload URL and credential.
Call the OSS native SDK to upload a video file to the specified bucket. Use
STS Authmode and use UploadAddress and UploadAuth for initialization. Do not use your AccessKey.
In addition to Java, Python, and PHP, the OSS native SDK supports the following languages:
For more information, see Use the OSS SDK to upload videos to ApsaraVideo for VOD.
You can also upload files based on the APIs of ApsaraVideo for VOD and OSS. The procedure is similar to that for using the OSS native SDK. In step 3, you need to call the OSS native API to upload files. For more information, see OSS file upload.