tencent cloud

Cloud Infinite

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Product Overview
Product Strengths
Use Cases
Feature Overview
Regions and Domains
Specifications and Limits
Billing
Billing Overview
Billing Mode
Billable Items
Free Tier
Payment Overdue
Viewing Bill Details
FAQs
Getting Started
Registering and Logging In
Bind Bucket
Uploading and Processing File
Downloading and Deleting Images
Unbinding Buckets
Using CI via COS
Features
Image Processing
Media Processing
Content Moderation
AI Content Recognition
File Processing
Smart Voice
File processing
User Guide
Overview
Bucket Management
Smart Toolbox
Job and Workflow
Data Monitoring
Usage statistics
Use Cases
Copyright Protection Solutions
Image Processing Practices
Working with API Authorization Policies
Workflow Practices
API Documentation
API Overview
Structure
Common Request Headers
Common Response Headers
Activate Vast Service
Image Processing
AI-Based Content Recognition
Smart Audio
Media Processing
Content Moderation
Document Processing
File Processing
Job and Workflow
Cloud Virus Detection
Error Codes
Request Signature
SDK Documentation
SDK Overview
Android SDK
iOS SDK
COS Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Go SDK
COS iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
Mini Program SDK
Personal Information Protection Policy for SDK
Security and Compliance
Permission ‍Management
FAQs
Basic Settings
Document Processing
Media Processing
Content Recognition
Smart Audio
Agreements
Service Level Agreement
Contact Us
Glossary

Video Moderation

PDF
Focus Mode
Font Size
Last updated: 2024-03-04 18:02:40

Overview

This document describes how to use the content moderation feature provided by Cloud Infinite (CI). CI fully integrates the processing capabilities with the COS SDK.
Note:
To use the content moderation service, you need to have the permission to use CI:
For root accounts, click here for role authorization.
This document provides an overview of APIs and SDK code samples for video moderation.
API
Description
Submits a video moderation job.
Queries the result of the specified video moderation job.

SDK API References

For parameters and method description of all APIs in the SDK, see SDK API Reference.

Creating a Task

Feature description

This API (QCloudPostVideoRecognitionRequest) is used to submit a video moderation job. You can receive the moderation result by setting the callback address or querying by JobId.
Note:
The COS iOS SDK version must be at least v6.0.9.

Sample request

Objective-C
Swift
QCloudPostVideoRecognitionRequest * request = [[QCloudPostVideoRecognitionRequest alloc]init];

// Object key, i.e., the full path of a COS object. If the object is in a directory, the path should be "dir1/object1".
request.object = @"exampleobject";

// File region
request.regionName = @"regionName";

// Bucket name in the format of BucketName-APPID
request.bucket = @"examplebucket-1250000000";

// Moderation type, such as `porn` (pornography) and `ads` (advertising).
// You can select multiple types; for example, `detect-type=porn,ads` indicates to moderate the image for pornographic and advertising information.
// You can use multiple parameters together, such as `QCloudRecognitionPorn | QCloudRecognitionTerrorist`.
request.detectType = QCloudRecognitionPorn | QCloudRecognitionAds;

// Frame capturing mode. Valid values: `Interval` (interval mode), `Average` (average mode), `Fps` (fixed frame rate mode).
// `Interval` mode: The `TimeInterval` and `Count` parameters take effect. If `Count` is set but `TimeInterval` is not, all frames will be captured to generate a total of `Count` images.
// `Average` mode: The `Count` parameter takes effect, indicating to capture a total of `Count` images at an average interval in the entire video.
// `Fps` mode: `TimeInterval` indicates how many frames to capture per second, and `Count` indicates how many frames to capture in total.
request.mode = QCloudVideoRecognitionModeFps;

// Video frame capturing frequency. Value range: (0.000, 60.000] seconds. The value supports the float format, accurate to the millisecond.
request.timeInterval = 1;

// The number of captured frames. Value range: (0, 10000].
request.count = 10;

// Moderation policy. If this parameter is not specified, the default policy will be used. For more information, visit https://www.tencentcloud.com/document/product/460/56345?from_cn_redirect=1.
request.bizType = @"BizType";

// Specify whether to moderate video sound. Valid values: `0` (moderates the video image only), `1` (moderates both the video image and video sound). Default value: `0`.
request.detectContent = YES;

request.finishBlock = ^(QCloudPostVideoRecognitionResult * outputObject, NSError *error) {
// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.
// `QCloudPostVideoRecognitionResult` class
};
[[QCloudCOSXMLService defaultCOSXML] PostVideoRecognition:request];

Note:
For more complete samples, visit GitHub.
let request : QCloudPostVideoRecognitionRequest = QCloudPostVideoRecognitionRequest();

// Object key, i.e., the full path of a COS object. If the object is in a directory, the path should be "dir1/object1".
request.object = "exampleobject";

// File region
request.regionName = "regionName";

// Bucket name in the format of BucketName-APPID
request.bucket = "examplebucket-1250000000";

// Moderation type, such as `porn` (pornography) and `ads` (advertising).
// You can select multiple types; for example, `detect-type=porn,ads` indicates to moderate the image for pornographic and advertising information.
// You can use multiple parameters together, such as `QCloudRecognitionPorn | QCloudRecognitionTerrorist`.
request.detectType = QCloudRecognitionEnum(rawValue: QCloudRecognitionEnum.porn.rawValue | QCloudRecognitionEnum.ads.rawValue!

// Frame capturing mode. Valid values: `Interval` (interval mode), `Average` (average mode), `Fps` (fixed frame rate mode).
// `Interval` mode: The `TimeInterval` and `Count` parameters take effect. If `Count` is set but `TimeInterval` is not, all frames will be captured to generate a total of `Count` images.
// `Average` mode: The `Count` parameter takes effect, indicating to capture a total of `Count` images at an average interval in the entire video.
// `Fps` mode: `TimeInterval` indicates how many frames to capture per second, and `Count` indicates how many frames to capture in total.
request.mode = QCloudVideoRecognitionMode.fps;

// Video frame capturing frequency. Value range: (0.000, 60.000] seconds. The value supports the float format, accurate to the millisecond.
request.timeInterval = 1;

// The number of captured frames. Value range: (0, 10000].
request.count = 10;

// Moderation policy. If this parameter is not specified, the default policy will be used. For more information, visit https://www.tencentcloud.com/document/product/460/56345?from_cn_redirect=1.
request.bizType = "BizType";

// Specify whether to moderate video sound. Valid values: `0` (moderates the video image only), `1` (moderates both the video image and video sound). Default value: `0`.
request.detectContent = true;

request.finishBlock = { (result, error) in
// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.
// `QCloudPostVideoRecognitionResult` class
}
QCloudCOSXMLService.defaultCOSXML().postVideoRecognition(request);
Note:
For more complete samples, visit GitHub.

Querying Job

Feature description

This API (QCloudGetVideoRecognitionRequest) is used to query the result of the specified video moderation job by job ID.
Note:
The COS iOS SDK version must be at least v6.0.9.

Sample request

Objective-C
Swift
QCloudGetVideoRecognitionRequest * request = [[QCloudGetVideoRecognitionRequest alloc]init];

// Bucket name in the format of BucketName-APPID
request.bucket = @"examplebucket-1250000000";

// The `jobid` returned by the `QCloudPostVideoRecognitionRequest` API
request.jobId = @"jobid";
[request setFinishBlock:^(QCloudVideoRecognitionResult * _Nullable result, NSError * _Nullable error) {
// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.
// `QCloudVideoRecognitionResult` class
}];
[[QCloudCOSXMLService defaultCOSXML] GetVideoRecognition:request];

Note:
For more complete samples, visit GitHub.
let request : QCloudGetVideoRecognitionRequest = QCloudGetVideoRecognitionRequest();

// Bucket name in the format of BucketName-APPID
request.bucket = "examplebucket-1250000000";

// The `jobid` returned by the `QCloudPostVideoRecognitionRequest` API
request.jobId = "jobid";

request.finishBlock = { (result, error) in
// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.
// `QCloudVideoRecognitionResult` class
}
QCloudCOSXMLService.defaultCOSXML().getVideoRecognition(request);
Note:
For more complete samples, visit GitHub.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback