All Products
Search
Document Center

Add a user-created OSS bucket to ApsaraVideo VOD

Last Updated: May 27, 2020

Overview

After you activate ApsaraVideo for VOD, the system automatically allocates a dedicated Object Storage Service (OSS) bucket to you. You can use this bucket to store media files such as video, audio, image, and subtitle files. You can also use this bucket as an origin to accelerate content delivery through Content Delivery Network (CDN). If you have a large number of media files stored in a user-created OSS bucket and it takes efforts to migrate these resources to the dedicated bucket, you can add the user-created bucket to ApsaraVideo for VOD.

Dedicated and user-created bucket comparison

The differences between the dedicated bucket and user-created bucket are as follows:

  1. Supported features: The dedicated bucket supports all features of ApsaraVideo for VOD. A user-created bucket may not support some of the new features. Currently, new features, such as uploading, transcoding (including encryption), snapshots, and AI processing (review and DNA) are all supported. However, we do not guarantee that user-created buckets will support the new features released in later versions.

  2. Management: ApsaraVideo for VOD manages the logical relations between media resources in the console and media files in buckets, which is more simple and efficient. If you use a user-created bucket, you only manage the media files. You cannot modify or delete media files stored in your bucket without changing the corresponding media resource information. If you want to delete a video or image file, we recommend that you use the ApsaraVideo for VOD API.

  3. Pricing: The dedicated bucket is more cost-effective. The fees of storage and outbound traffic over Internet are charged at the same prices as OSS. However, you do not need to pay for rerouting requests back to origins through CDN or calling the ApsaraVideo for VOD API. In addition, ApsaraVideo for VOD provides 50 GB of storage space, which is free of charge.

Considerations

  1. A user-created OSS bucket supports the basic features of ApsaraVideo for VOD. Only OSS storage fees are charged. ApsaraVideo for VOD does not charge any storage fee.

  2. A user-created OSS bucket must reside in a region that supports ApsaraVideo for VOD, such as China (Beijing) and China (Shanghai). For more information about the available regions, see VOD centers and access domains.

  3. Media transcoding in ApsaraVideo for VOD is based on ApsaraVideo for Media Processing. If your bucket is already added to ApsaraVideo for Media Processing, you cannot add it to ApsaraVideo for VOD.

Procedure

Activate ApsaraVideo for VOD. If you have activated ApsaraVideo for VOD, skip this step. Then, use Resource Access Management (RAM) to authorize ApsaraVideo for VOD and the transcoding service and complete the basic configurations of ApsaraVideo for VOD.

Authorize ApsaraVideo for VOD

Use RAM to grant ApsaraVideo for VOD the permission to access your OSS resources. To complete the authorization, click here.

Authorize the transcoding service

Use RAM to grant ApsaraVideo for Media Processing the permission to access your OSS resources.

Step 1: Create a RAM role

  1. Log on to the RAM console and open the RAM Roles page. Click Create RAM Role. In the right-side dialog box that appears, select Alibaba Cloud Service and click Next.

  2. In the Configure Role step, select Media Transcoding Service as the trusted service.

  3. Set the RAM role name to vod-pass-mps and click Create, as shown in the following figure.

create-role-step1.jpgcreate_vod-pass-mps-role_2

  1. After you create the RAM role, close the dialog box and go back to the RAM Roles page. Click vod-pass-mps in the RAM role list. On the page that appears, click the Trust Policy Management tab and then the Edit Trust Policy button, as shown in the following figure.create_vod-pass-mps-role_3

Replace the code framed in red with the following code:

  1. {
  2. "Statement": [
  3. {
  4. "Action": "sts:AssumeRole",
  5. "Effect": "Allow",
  6. "Principal": {
  7. "Service": [
  8. "1874305272421199@mts.aliyuncs.com"
  9. ]
  10. }
  11. }
  12. ],
  13. "Version": "1"
  14. }

Step 2: Create a RAM policy

  1. In the RAM console, click Policies in the left-side navigation pane and click Create Policy, as shown in the following figure.create_vod-pass-mps-role_1

  2. Configure the policy, as shown in the following figure.create_policy_2

Set the policy name to vod-pass-mps and replace the policy content with the following code:

  1. {
  2. "Version": "1",
  3. "Statement": [
  4. {
  5. "Effect": "Allow",
  6. "Action": "oss:*",
  7. "Resource": [
  8. "acs:oss:*:*:*",
  9. "acs:oss:*:*:*/*"
  10. ]
  11. }
  12. ]
  13. }

Step 3: Use the RAM policy to grant permissions to the RAM role

In the RAM console, click RAM Roles in the left-side navigation pane. On the RAM Roles page, find the RAM role vod-pass-mps and click Add Permissions in the Actions column. In the right-side dialog box that appears, find and click the vod-pass-mps policy to add it to the Selected section on the right. Then, click OK. The following figure shows these steps.create_policy_1

Configure ApsaraVideo for VOD

  1. After you complete the preceding authorization, add a user-created OSS bucket to ApsaraVideo for VOD. You can submit a ticket or contact the ApsaraVideo for VOD service team offline to express your expectation of using a user-created OSS bucket. You are required to provide the account ID, bucket name, and region.You can find your account ID on the Security Settings page in the Account Management console.account-info.jpg
  2. Log on to the ApsaraVideo for VOD console and open the Domain Names page to add a domain name. On the Add Domain Name page, select OSS Domain Name and specify a custom OSS origin.
  3. Go to the Transcode page. Configure a transcoding template and specify the default template group. If you do not want to use the transcoding feature, select No Transcoding. For more information, see Transcoding settings.

Upload and register media resources

Upload a media resource

We recommend that you use the upload SDK of ApsaraVideo for VOD to upload a media resource. If you use the OSS API or SDK to directly upload a resource to the bucket, the resource cannot be transcoded in subsequent tasks.

To avoid this issue, you can use the OSS API or SDK to upload the resource to the storage of ApsaraVideo for VOD with an upload credential. For more information, see Upload URL and credential. This method is not recommended because it incurs additional development and debugging costs. For more information about how to use this method, see Upload videos by using the OSS native SDK.

Register a media resource

For media resources that are stored in the bucket, you only need to register them with ApsaraVideo for VOD.

  1. Use the OSS API or SDK to list all resource files stored in the bucket. An object list is returned. For more information, see View the object list.

  2. Call the RegisterMedia operation to generate a media ID for the media resource that you want to register. The path of the media resource specified in the FileURL parameter must include the OSS endpoint, for example:

    1. http://sample.oss-cn-shanghai.aliyuncs.com/video/sample.mp4
  3. Call the SubmitTranscodeJobs or SubmitSnapshotJob operation to process the media resource with the specified media ID as required.