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. Then, Content Moderation can use the role to submit a video frame capture task. You must use the role management feature of Alibaba Cloud Resource Access Management (RAM). 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 China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen) regions.

Procedure

  1. Create a RAM role and grant permissions.
    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.
    1. Log on to the RAM console.
    2. Go to the RAM Roles page. Then, click Create RAM Role.
    3. Select Alibaba Cloud Service as the trusted entity type 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.Media transcoding
    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.
    7. In the Add Permissions panel, select the AliyunOSSReadOnlyAccess policy and click OK.ossreadonly
      This operation grants the RAM role only read permissions on OSS data that belongs to your Alibaba Cloud account.
  2. Modify the trust policy of the RAM role.
    1. On the RAM 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.Trust policy
    3. In the Edit Trust Policy panel, 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 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 the Alibaba Cloud resource name (ARN).arn
  2. Generate the video URL for a video to be moderated in OSS 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 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.

  3. When you submit an asynchronous video moderation task, use the generated video URL.
    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 Asynchronous moderation.
    • The supported regions are China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen).