Content Moderation calls ApsaraVideo for Media Processing to capture video frames. In this way, data is accessed over the internal network to minimize the costs of Internet traffic. You must authorize a role to access ApsaraVideo for Media Processing. Then, Content Moderation can use the role to submit a video frame capture task. This topic describes how to create and authorize a role in the Resource Access Management (RAM) console.

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. To ensure automatic frame capture, you must authorize a role to access ApsaraVideo for Media Processing.
After you perform the operations described in this topic, you can achieve the following expected results:
  • A RAM role is created for your Alibaba Cloud account and used by Content Moderation to call ApsaraVideo for Media Processing.

    For more information about RAM roles, see RAM role overview.

  • The RAM role is granted the permission to access your Object Storage Service (OSS) buckets in the read-only mode.
  • Video URLs to be submitted are generated in the oss://xxxx format.
    Note The method of submitting a video URL to specify the video to be moderated is available only for asynchronous video moderation tasks. For more information, see Moderate videos asynchronously.

After a role is authorized, Content Moderation under your Alibaba Cloud account can use the role to call ApsaraVideo for Media Processing, access your OSS buckets, and then capture frames for videos in your OSS buckets.

Procedure

  1. Create a RAM role.
    1. Log on to the RAM console.
    2. In the left-side navigation pane, click RAM Roles. On the RAM Roles page, click Create RAM Role.
    3. In the Create RAM Role right-side pane that appears, select Alibaba Cloud Service and click Next.Create a role and select a role type
    4. Set the RAM Role Name parameter and select Media Transcoding Service from the Select Trusted Service drop-down list.Create RAM Role right-side pane
    5. Click OK.
      Note This operation may require mobile phone-based authentication.
      Role created
    6. After the role is created, click Add Permissions to RAM Role in the Create RAM Role right-side pane.
    7. In the Add Permissions right-side pane that appears, select the AliyunOSSReadOnlyAccess policy and click OK.ossreadonly
      This policy grants the role the permission to access OSS buckets under your Alibaba Cloud account in the read-only mode.
  2. Modify the trust policy.
    1. On the RAM Roles page, find the created role and click the role name to view details.
    2. Click the Trust Policy Management tab and then click Edit Trust Policy.Trust policy
    3. In the Edit Trust Policy right-side pane that appears, replace the content of "Service" with "1184847062244573@mts.aliyuncs.com". Click OK.Trust policy
      This operation specifies that the Alibaba Cloud account whose UID is 1184847062244573 assumes the created role to call ApsaraVideo for Media Processing.
  3. On the role details page, view and copy the Alibaba Cloud resource name (ARN) in the Basic Information section.arn
  4. Generate the video URL for a video to be moderated in an OSS bucket in the following format: oss://arn@bucket.region/object.
    Assume that you want to moderate the video/bar.mp4 object in the foo OSS bucket that resides in the China (Shenzhen) region. The generated OSS URL of the video is oss://acs:ram::xxxxxxxxxxxxxxxx:role/mts-to-a@foo.cn-shenzhen/video/bar.mp4. xxxxxxxxxxxxxxxx is the 16-digit ID of your Alibaba Cloud account.
    Note The following regions support the preceding operation: China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen).
  5. When you submit an asynchronous video moderation task, use the generated video URL.