All Products
Search
Document Center

ApsaraVideo VOD:Server upload SDKs

Last Updated:Jun 13, 2024

You can upload media files from application servers to Object Storage Service (OSS) buckets allocated to ApsaraVideo VOD. ApsaraVideo VOD provides server upload SDKs for common programming languages and demos. Server upload SDKs encapsulate the logic that can be used to obtain upload URLs and credentials. You need to only perform simple configurations before you use the SDKs to start uploads. This topic describes the scenarios, upload process, and usage of server upload SDKs.

Scenarios

You can use server upload SDKs if you want to perform automatic upload or upload a large number of video files or online media files. To upload online media files, you must download the files to an application server and then upload the files to ApsaraVideo VOD from the application server.

Feature

Description

Remarks

Programming languages

Java, Python, PHP, C, and C++ are supported.

For other programming languages, use OSS SDKs. For more information, see Upload media files by using OSS SDKs.

Supported media files

For information about supported media file formats, see Overview.

You can upload local files and online files. Online files are uploaded by using the URLs.

  • You can upload a local media file of up to 48.8 TB.

  • You can upload an online file of up to 5 GB.

Note

To upload media files by using URLs, you must encode the URLs. This prevents upload failures caused by special characters in the URLs.

Storage addresses

You can use the default storage address or specify a storage address.

You can change the default storage address. For more information, see Manage storage buckets.

The URL-based upload is supported only in the China (Shanghai) region.

You can specify the storage address by setting the StorageLocation parameter when you call an API operation to obtain an upload URL and credential.

Upload over an internal network

If you want to deploy the upload script on an Elastic Compute Service (ECS) instance, you can specify the region where the ECS instance resides in the upload logic. If the region of the ECS instance is the same as the storage region of ApsaraVideo VOD, files are automatically uploaded over an internal network. This accelerates uploads and reduces Internet traffic.

The ApsaraVideo VOD API can only be called by using public domain names. You must use an ECS instance that can access the Internet to deploy the upload script.

Media asset management

You can configure media metadata, such as media titles, tags, categories, and thumbnails.

You can configure the metadata by setting parameters such as Title, Tags, CateId, and CoverURL when you call an operation to obtain an upload URL and credential.

Audio and video transcoding

You can specify a transcoding template or workflow to transcode uploaded audio and video files.

You can also upload audio and video files without transcoding.

You can configure transcoding by setting parameters such as TemplateGroupId and WorkflowId when you call an operation to obtain an upload URL and credential.

Upload control

You can configure the upload progress bar and use the default or custom progress callbacks.

The resumable upload feature is supported for only the server upload SDK for Java. Server upload SDKs for other programming languages do not support this feature.

You cannot configure the upload progress bar for M3U8 files.

Event notifications

You can configure callbacks to receive notifications for upload events. For more information about supported event notifications, see Upload settings.

For more information about how to configure the callbacks, see Configure callbacks.

Upload authorization

You can grant the upload permission by using an upload credential. In this case, you need to use an AccessKey pair of an Alibaba Cloud account or an authorized RAM user to initialize an upload instance.

You can also grant the upload permission by using a Security Token Service (STS) token. In this case, you need to use an STS token to initialize an upload instance.

If you grant the upload permission by using an STS token, you must deploy a service to obtain STS tokens.

Upload acceleration

You must enable the upload acceleration feature to use this feature. You must submit a ticket to enable the upload acceleration feature.

After you enable this feature, you can configure the feature by setting AccelerateConfig in UserData when you call an operation to obtain an upload URL and credential.

Note

ApsaraVideo VOD provides the following API operations used to obtain upload URLs and credentials:

Upload process

Server upload SDKs encapsulate the logic that can be used to obtain upload URLs and credentials and the OSS upload logic. You need to only perform simple configurations before you use the SDKs to start uploads. The following figure shows a complete upload process.Upload process

Upload process

  1. Integrate the server upload SDK into your application server and complete the upload settings. For example, configure the AccessKey pair, file path, storage address, media asset information, transcoding settings, and upload control settings.

  2. The application server uses the server upload SDK to call an API operation to obtain an upload URL, an upload credential, and media asset information.

    Note

    Alternatively, you can construct an HTTP or HTTPS request to obtain an upload URL and credential. However, this method requires you to construct a signature and may cause errors. ApsaraVideo VOD provides the following operations related to upload URLs and credentials:

  3. ApsaraVideo VOD returns the upload URL, upload credential, and media ID to the application server.

    Note

    ApsaraVideo VOD generates media IDs when it returns upload URLs and credentials. Media IDs are used for lifecycle management and media processing.

    • For a video, the media ID is returned in the VideoId parameter.

    • For an image, the media ID is returned in the ImageId parameter.

    • For an auxiliary media asset, the media ID is returned in the MediaId parameter.

    • Record the returned media IDs that are required for subsequent tasks, such as media asset management, audio and video playback, and media processing.

  4. The application server starts the upload based on the OSS upload logic encapsulated by the server upload SDK.

  5. The OSS client returns the upload result.

    Note

    You can also configure a callback in advance to listen to the upload result.

References

The procedure for integrating and using server upload SDKs varies based on the programming language. For more information about how to integrate and use server upload SDKs, see the following topics:

Differences between server upload SDKs and server operation SDKs

The server upload SDKs and server operation SDKs provided by ApsaraVideo VOD are different. The server upload SDKs encapsulate the complete upload logic. You can integrate the upload SDKs and start uploads. The server operation SDKs integrate all features of ApsaraVideo VOD. For the upload feature, the server operation SDKs encapsulate only the logic of obtaining an upload URL and credential. If you use the server operation SDKs to upload media files, you must develop the upload logic. For example, you must obtain an upload URL and credential from ApsaraVideo VOD, decode the Base64-encoded upload URL and credential, and use OSS to upload files. For more information about the server operation SDKs of ApsaraVideo VOD, see Server SDK Reference.