This topic describes the /green/video/syncscan operation that you can call to moderate videos and obtain 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.

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 To use this scenario, you must call the /green/video/asyncscan operation to submit asynchronous video moderation tasks. For more information, see Asynchronous moderation.
Detects audio violations in a video.
Note By default, the audio to be moderated must be in Chinese. If you need to moderate audio in English, submit a ticket to contact Alibaba Cloud technical support.
normal, spam, ad, politics, terrorism, abuse, porn, flood, contraband, and customized

Operation 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 method, see Content Moderation Pricing.

    If your moderation occurs in multiple scenarios 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.

  • Moderation 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 need 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 video frames must use HTTP or HTTPS URLs.
    • The video frames must be in the 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 effects.
    • 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).

Request parameters

Parameter Type Required Description
bizType String No 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 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 objects. Each element in the JSON array is a structure. For more information about the structure of each element, see task.
Table 1. task
Parameter Type Required Description
clientInfo JSONObject No The information about the client. For more information, see the "Common request parameters" section of the Common parameters topic.
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 The ID of the moderation object.

The ID can contain letters, digits, underscores (_), hyphens (-), and periods (.)and 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.
framePrefix String No The prefix of the URL of a captured frame, which is used with frame.url to form the complete URL of a captured frame. The complete URL of a captured frame is in the format of framePrefix + frame.url.
Table 2. frame
Parameter Type Required Description
url String Yes The URL of the captured frame, which is used with framePrefix to form the complete URL of a captured frame. The complete URL of a captured frame is in the format of framePrefix + frame.url.
offset Integer No The interval between the start of the video and the captured frame. Unit: seconds.

Response parameters

Parameter Type Description
code Integer The returned HTTP status code.

For more information, see Common HTTP status codes.

msg String The returned message.
dataId String The ID of the moderation object.
Note If you set the dataId parameter in the moderation request, the dataId parameter is returned in the response.
taskId String The ID of the moderation task.
results JSONArray The return results. If HTTP status code 200 is returned after a successful call, the array in the return results contains one or more elements. Each element is a structure. For more information about the structure of each element, see result.
Table 3. result
Parameter Type Description
scene String The moderation scenario of the moderated video, which you specify 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 The category of the moderation result of the moderated video. Valid values vary based on the specified moderation scenario.
  • 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 If the scenes parameter is set to porn or terrorism, the subcategory of the moderation result can be returned.

By default, this parameter is not returned. If you want this parameter to be returned, submit a ticket. This parameter can be returned only after it is configured by Alibaba Cloud engineers.

suggestion String The recommended subsequent operation for you to perform. Valid values:
  • pass: The moderation object does not require further actions.
  • review: The moderation object contains suspected violations and requires human review.
  • block: The moderation object contains violations. We recommend that you delete or block the object.
rate Float 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.
Notice This score is for reference only. We recommend that you do not use this score in your business. 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 moderation results of captured frames. 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 that the detected text in the moderated video hits. For more information about the structure, see hitLibInfo.

Example:
"hitLibInfo":[{"context":"Haokan","libCode":"2144002","libName":"Text pattern library a"}]
hintWordsInfo JSONArray The information about the term that the detected ad or illegal text in the moderated video hits. For more information about the structure, see hintWordsInfo.
Note This parameter is applicable only to ad violation detection.
Example:
"hintWordsInfo":[{"context":"Sensitive words"}]
logoData JSONArray The information about the detected logo 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 detected terrorist content in the moderated video. For more information about the structure, see sfaceData.
Note This parameter is applicable only to terrorist content detection.
Table 4. frame
Parameter Type Description
url String The URL of the captured frame.
offset Integer The interval between the start of the video and the captured frame. Unit: seconds.
label String The category of the moderation result of the captured frame. Valid values vary based on the specified moderation scenario.
  • 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
rate Floa The score of the confidence level. Valid values: 0 to 100. A higher confidence level indicates higher reliability of the moderation result. We recommend that you do not use this score in your business.
Table 5. logoData
Parameter Type Example Description
type String TV The type of the detected logo. For example, a value of TV indicates the logo of a TV station.
name String xxx TV The name of the detected logo.
x Float 140 The 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: pixels.
y Float 68 The 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: pixels.
w Float 106 The width of the logo area. Unit: pixels.
h Float 106 The height of the logo area. Unit: pixels.
Table 6. sfaceData
Parameter Type Example Description
x Float 49 The 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: pixels.
y Float 39 The 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: pixels.
w Float 97 The width of the face area. Unit: pixels.
h Float 131 The height of the face area. Unit: pixels.
faces JSONArray [{"id":"AliFace_0001234","name":"Hit name","rate":91.54}] The information about the recognized face. The array contains the following parameters:
  • name: the name of 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 result. The value is a floating-point number.
  • id: the ID of the recognized face. The value is a string.
Table 7. hitLibInfo
Parameter Type Example Description
context String xxxx The custom text that the detected text hits.
libCode String 123456 The code of the library that contains the custom text hit by the detected text.
libName String abc The name of the library that contains the custom text hit by the detected text.
Table 8. hintWordsInfo
Parameter Type Example Description
context String xxxx The term that the detected text hits.

Examples

Sample requests
{
    "scenes": [
        "porn"
    ],
    "tasks": [
        {
            "dataId": "videoId xxx",
            "frames": [
                {
                    "offset": 10,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460000"
                },
                {
                    "offset": 20,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460001"
                },
                {
                    "offset": 30,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460002"
                },
                {
                    "offset": 40,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460003"
                },
                {
                    "offset": 50,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460003"
                },
                {
                    "offset": 60,
                    "url": "http://g1.ykimg.com/0B860000586C0A0300038A046000x"
                }
            ]
        }
    ]
}
Sample success responses
{
    "code": 200,
    "msg": "OK",
    "requestId": "requestID xxx",
    "data": [
        {
            "code": 200,
            "msg": "OK",
            "dataId": "videoId xxx",
            "taskId": "taskId xxx",
            "results": [
                {
                    "label": "porn",
                    "rate": 99.2,
                    "scene": "porn",
                    "suggestion": "block",
                    "frames": [
                        {
                            "offset": 50,
                            "url": "http://g1.ykimg.com/0B860000586C0A0300038A0460003",
                            "label": "porn",
                            "rate": 99.1
                        }
                    ]
                }
            ]
        }
    ]
}