Content Moderation calls ApsaraVideo for Media Processing to capture frames for the videos that are uploaded to Object Storage Service (OSS). You must authorize a role to access ApsaraVideo for Media Processing, by using the role management feature of Alibaba Cloud Resource Access Management (RAM). Then, Content Moderation can use the role to submit a video frame capture task. This topic describes how to perform the required steps.

Background information

  • If you submit an asynchronous video moderation task and specify the video URL in the oss://xxxx format, Content Moderation can automatically capture frames for the video that is uploaded to OSS. To ensure automatic frame capture, you must authorize a role to access ApsaraVideo for Media Processing.
  • The OSS service is available in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen).

Procedure

  1. Create a RAM role and grant permissions to this role.
    Create a RAM role that can access ApsaraVideo for Media Processing for your Alibaba Cloud account. Authorize your Alibaba Cloud account to assume the role. Make sure that Content Moderation has been activated by using your Alibaba Cloud account.
    1. Log on to the RAM console.
    2. In the left-side navigation pane, choose Identities > Roles.
    3. On the Roles page, click Create Role.
    4. In the Create Role panel, select Alibaba Cloud Service as the trusted entity and click Next.
    5. Select Normal Service Role as the role type, set RAM Role Name, select Media Transcoding Service as the trusted service, and then click OK.
      Note This operation may require mobile phone-based verification.
    6. After the role is created, click Add Permissions to RAM Role.
    7. In the Add Permissions panel, select the AliyunOSSReadOnlyAccess system policy and click OK.
      This operation grants the RAM role read-only permissions on OSS data that belongs to your Alibaba Cloud account.
  2. Modify the trust policy of the RAM role.
    1. On the Roles page, click the name of the created role to go to the role details page.
    2. Click the Trust Policy Management tab and then click Edit Trust Policy.
    3. In the Edit Trust Policy panel, replace the content of "Service" with "118484706224****@mts.aliyuncs.com", and click OK.
      This operation specifies that the Alibaba Cloud account whose UID is 118484706224**** assumes the created RAM role to call ApsaraVideo for Media Processing. Content Moderation is also used within this Alibaba Cloud account.

What to do next

After the role is authorized, you must use a URL of the specified format when you submit an asynchronous moderation task for a video to be moderated in OSS. To use the URL of the specified format, perform the following steps:
  1. On the role details page, view and copy ARN, which indicates the Alibaba Cloud resource name.
  2. Generate a URL for a video to be moderated in OSS. The URL is in the following format: oss://arn@bucket.region/object.

    Assume that you want to moderate the video/bar.mp4 object in the f** OSS bucket that resides in the China (Shenzhen) region. The generated URL of the video is oss://acs:ram::118484706224****:role/mts-to-a@f**.cn-shenzhen/video/bar.mp4, where 118484706224**** is the 16-digit ID of your Alibaba Cloud account.

  3. When you submit an asynchronous video moderation task, use the generated URL.
    Note The method of using a URL to specify the video to be moderated is available only for asynchronous video moderation tasks. For more information, see /green/video/asyncscan.