All Products
Search
Document Center

Content Moderation:/green/video/syncscan

Last Updated:Apr 17, 2024

Moderates videos and obtains moderation results in real time. You can call this operation to moderate videos for risky or illegal content. This operation is applicable to the following scenarios: pornography detection, terrorist content detection, ad violation detection, undesirable scene detection, and logo detection.

Description

Operation: /green/video/syncscan

You can call this operation to submit video moderation tasks and obtain moderation results in real time. For more information about how to construct an HTTP request, see Request structure. You can also select an existing HTTP request. For more information, see SDK overview.

  • Billing method:

    You are charged for calling this operation. For more information about the billing methods, see Content Moderation Pricing.

    If you specify multiple scenarios for moderation at a time, you are charged the cumulative fee of all scenarios. The fee of each scenario equals the number of video frames that are moderated in the scenario multiplied by the unit price of the scenario.

  • Moderated object:

    To call the /green/video/syncscan operation, you must submit a sequence of frames that are captured from the video to be moderated. If you want to submit a video URL to specify the video to be moderated, we recommend that you call the /green/video/asyncscan operation.

  • Limits on frames captured from a video:

    • The URLs of video frames must be HTTP or HTTPS URLs.

    • The video frames must be in PNG, JPG, JPEG, BMP, GIF, or WEBP format.

    • A video frame can be up to 10 MB in size.

    • We recommend that you submit video frames of at least 256 × 256 pixels to ensure the moderation effect.

    • The response time of an operation for moderating videos varies based on the duration for downloading the frames that are captured from the videos. Make sure that you use a stable and reliable storage service to store the video frames to be moderated. We recommend that you use Object Storage Service (OSS) or Content Delivery Network (CDN).

Table 1. Scenarios

Scenario

Description

Category of the moderation result

Pornography detection

Detects pornographic content in a video.

normal and porn

Terrorist content detection

Detects terrorist content in a video.

normal and terrorism

Undesirable scene detection

Detects undesirable scenes in a video.

normal and live

Logo detection

Detects specific logos in a video.

normal and logo

Ad violation detection

Detects ads or text violations in a video.

normal and ad

Audio anti-spam

Note

For this scenario, you must call the /green/video/asyncscan operation to submit asynchronous video moderation tasks. For more information, see /green/video/asyncscan and /green/video/results.

Detects audio anti-spam in a video.

Note

By default, the audio to be moderated must be in Chinese. If you need to moderate audio in English, contact your sales manager.

normal, spam, ad, politics, terrorism, abuse, porn, flood, contraband, and customized

QPS limits

You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

Request parameters

Parameter

Type

Required

Example

Description

bizType

String

No

default

The business scenario. You can create a business scenario in the Content Moderation console. For more information, see Customize policies for machine-assisted moderation.

scenes

StringArray

Yes

["porn"]

The video moderation scenario. Valid values:

  • porn: pornography detection

  • terrorism: terrorist content detection

  • live: undesirable scene detection

  • logo: logo detection

  • ad: ad violation detection

tasks

JSONArray

Yes

The list of moderation tasks that you want to submit. The JSON array can contain one or more elements. Each element is a structure. The JSON array can contain up to 100 elements. In other words, you can submit up to 100 tasks at a time. To submit 100 tasks at a time, you must raise the relevant concurrency limit to a number greater than 100. For more information about the structure of each element, see task.

Table 2. task

Parameter

Type

Required

Example

Description

clientInfo

JSONObject

No

{"userId":"12023****","userNick":"Mike","userType":"others"}

The information about the client. For more information, see the "Common request parameters" section of Common parameters.

The server determines whether to use the global clientInfo parameter or the clientInfo parameter that is described in this table.

Note

The clientInfo parameter in this table takes priority over the global one.

dataId

String

No

videoId****

The ID of the moderation object.

The ID can contain letters, digits, underscores (_), hyphens (-), and periods (.). It can be up to 128 characters in length. This ID uniquely identifies your business data.

frames

JSONArray

Yes

The information about frames that are captured from the video to be moderated. Each element in the JSON array of the frames parameter is a structure. For more information about the structure of each element, see frame.

A maximum of 200 frames can be captured from each video to be moderated.

framePrefix

String

No

The prefix of the URL of a captured frame, which is used with frame.url to form the complete URL of the frame. The complete URL of a captured frame is in the format of framePrefix + frame.url. For more information, see frame.

Table 3. frame

Parameter

Type

Required

Example

Description

url

String

Yes

http://www.aliyundoc.com/test0001.jpg

The HTTP or HTTPS URL that can be accessed over the Internet. The URL is up to 2,048 characters in length.

offset

Integer

No

10

The interval between the start of the video and the captured frame. Unit: seconds.

Response parameters

Parameter

Type

Example

Description

code

Integer

200

The returned HTTP status code.

For more information, see Common error codes.

msg

String

OK

The message that is returned in response to the request.

dataId

String

videoId****

The ID of the moderation object.

Note

If you set the dataId parameter in the moderation request, the value of the dataId request parameter is returned here.

taskId

String

taskId****

The ID of the moderation task.

results

JSONArray

The moderation results. If the call is successful, the HTTP status code 200 and moderation results are returned. The array of moderation results contains one or more elements. Each element is a structure. For more information about the structure, see result.

Table 4. result

Parameter

Type

Example

Description

scene

String

porn

The video moderation scenario that you specified in the moderation request. Valid values:

  • porn: pornography detection

  • terrorism: terrorist content detection

  • live: undesirable scene detection

  • logo: logo detection

  • ad: ad violation detection

label

String

porn

The category of the video moderation result. Valid values:

  • If the scenes parameter is set to porn, the valid values are:

    • normal: normal

    • porn: pornographic content

  • If the scenes parameter is set to terrorism, the valid values are:

    • normal: normal

    • terrorism: terrorist content

  • If the scenes parameter is set to live, the valid values are:

    • normal: normal

    • live: undesirable scene

  • If the scenes parameter is set to logo, the valid values are:

    • normal: normal

    • logo: logo

  • If the scenes parameter is set to ad, the valid values are:

    • normal: normal

    • ad: ad or text violation

sublabel

String

porn

If the scenes parameter is set to porn or terrorism, the subcategory of the moderation result can be returned in this parameter.

This parameter is not returned by default.

suggestion

String

block

The recommended subsequent operation. Valid values:

  • pass: The moderated object does not require further actions.

  • review: The moderated object contains suspected violations and requires manual review.

  • block: The moderated object contains violations. We recommend that you delete or block the object.

rate

Float

99.2

The score of the confidence level. Valid values: 0 to 100. A greater value indicates a higher confidence level.

If a value of pass is returned for the suggestion parameter, a higher confidence level indicates a higher probability that the content is normal. If a value of review or block is returned for the suggestion parameter, a higher confidence level indicates a higher probability that the content contains violations.

Important

We recommend that you use the values that are returned for the suggestion, label, and sublabel parameters to determine whether the content contains violations. The sublabel parameter is returned by specific operations.

frames

JSONArray

The information about the captured frames that contain violations. For more information about the structure, see frame.

extras

JSONObject

The additional information.

If you specify ad in the scenes parameter to detect ad violations, the extras parameter can return the following content:

hitLibInfo: The information about the custom text library hit by the text detected in the moderated video. For more information about the structure, see hitLibInfo.

hintWordsInfo

JSONArray

The information about the term hit by the ad or illegal text detected in the moderated video. For more information about the structure, see hintWordsInfo.

Note

This parameter is applicable only to ad violation detection.

logoData

JSONArray

The information about the logo detected in the moderated video. For more information about the structure, see logoData.

Note

This parameter is applicable only to logo detection.

sfaceData

JSONArray

The information about the terrorist content detected in the moderated video. For more information about the structure, see sfaceData.

Note

This parameter is applicable only to terrorist content detection.

Table 5. frame

Parameter

Type

Example

Description

url

String

http://www.aliyundoc.com/0B860000586C0A0300038A0460003

The HTTP or HTTPS URL that can be accessed over the Internet. The URL is up to 2,048 characters in length.

offset

Integer

50

The interval between the start of the video and the captured frame. Unit: seconds.

label

String

porn

The category of the moderation result of the captured frame.

rate

Float

99.1

The score of the confidence level. Valid values: 0 to 100. A higher confidence level indicates higher reliability of the moderation results. We recommend that you do not use this score in your business.

Table 6. logoData
ParameterTypeExampleDescription
typeStringTVThe type of the detected logo. For example, a value of TV indicates a logo of banned media.
nameStringxxx TVThe name of the detected logo.
xFloat140The distance between the upper-left corner of the logo area and the y-axis, with the upper-left corner of the image being the coordinate origin. Unit: pixel.
yFloat68The distance between the upper-left corner of the logo area and the x-axis, with the upper-left corner of the image being the coordinate origin. Unit: pixel.
wFloat106The width of the logo area. Unit: pixel.
hFloat106The height of the logo area. Unit: pixel.
Table 7. sfaceData
ParameterTypeExampleDescription
xFloat49The distance between the upper-left corner of the face area and the y-axis, with the upper-left corner of the image being the coordinate origin. Unit: pixel.
yFloat39The distance between the upper-left corner of the face area and the x-axis, with the upper-left corner of the image being the coordinate origin. Unit: pixel.
wFloat97The width of the face area. Unit: pixel.
hFloat131The height of the face area. Unit: pixel.
facesJSONArray[{"name":"Hit name","rate":91.54,"id":"AliFace_0123****"}]The information about the recognized faces. Each element in the array contains the following parameters:
  • name: the name of the person with the recognized face. The value is a string.
  • rate: The score of the confidence level. Valid values: 0 to 100. A greater value indicates a higher confidence level. A higher confidence level indicates higher reliability of the facial recognition results. The value is a floating-point number.
  • id: the ID of the recognized face. The value is a string.
Table 8. hitLibInfo
ParameterTypeExampleDescription
contextStringHaokanThe custom term hit by the detected text.
libCodeString123456The code of the library that contains the custom term hit by the detected text.
libNameStringabcThe name of the library that contains the custom term hit by the detected text.
Table 9. hintWordsInfo
ParameterTypeExampleDescription
contextStringHaokanThe term hit by the detected text.

Examples

Sample requests

http(s)://[Endpoint]/green/video/syncscan
&<Common request parameters>
{
    "scenes": [
        "porn"
    ],
    "tasks": [
        {
            "dataId": "videoId****",
            "frames": [
                {
                    "offset": 10,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A0460000"
                },
                {
                    "offset": 20,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A0460001"
                },
                {
                    "offset": 30,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A0460002"
                },
                {
                    "offset": 40,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A0460003"
                },
                {
                    "offset": 50,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A0460003"
                },
                {
                    "offset": 60,
                    "url": "http://www.aliyundoc.com/0B860000586C0A0300038A046000x"
                }
            ]
        }
    ]
}

Sample success responses

{
    "code": 200,
    "msg": "OK",
    "requestId": "requestID****",
    "data": [
        {
            "code": 200,
            "msg": "OK",
            "dataId": "videoId****",
            "taskId": "taskId****",
            "results": [
                {
                    "label": "porn",
                    "rate": 99.2,
                    "scene": "porn",
                    "suggestion": "block",
                    "frames": [
                        {
                            "offset": 50,
                            "url": "http://www.aliyundoc.comm/0B860000586C0A0300038A0460003",
                            "label": "porn",
                            "rate": 99.1
                        }
                    ]
                }
            ]
        }
    ]
}