tencent cloud

All product documents
APIs
Submitting Audio Moderation Task
Last updated: 2024-02-19 14:59:07
Submitting Audio Moderation Task
Last updated: 2024-02-19 14:59:07

Feature Overview

This interface is used to submit an audio moderation task. The audio moderation functions asynchronously. You can submit an audio moderation task to moderate your audio files. Subsequently, the moderation results can be retrieved through the querying audio moderation job result or audio moderation callback content.
This interface supports the following operations:
Note:
Moderation of audio files stored in Tencent Cloud's COS is supported.
Moderation of audio URLs hosted by the third-party cloud storage providers is supported.
Automatic detection of audio files from two dimensions of ASR and erotic moaning is supported. It uses the deep learning technology to identify violations in the audio.
Setting a callback address to receive the detection results or actively polling the querying audio moderation job result to obtain the detailed moderation results is supported.
Recognition of a variety of violations such as instances of pornography and advertising is supported.
Setting custom policy based on different business scenarios is supported.

Authorization Guidelines

The action is set to ci:CreateAuditingAudioJob for the authorization policy. See all actions for more details.

Activation of Services

It is required to activate CI and bind a bucket before the use of this function. For more details, please refer to binding a bucket.

Use Limits

Before using API, please confirm all the relevant limitations. For more details, see Use Limits.
Audio file size: File size < 600MB.
Audio file duration: Less than 3 hours.
Audio bitrate type: 128–256 Kbps.
Audio file formats: MP3, WAV, AAC, FLAC, AMR, 3GP, M4A, WMA, OGG, APE.
Default concurrent API calls: 10.
Languages for audio content: Mandarin, English, and Cantonese.
When a video file is entered, the separation of the audio track of a video file for independent moderation of the audio content is supported.

Note on Fees

Each moderation scenario is billed separately. For instance, if you choose to moderate both pornographic and advertising content, moderating one audio file will incur two moderation charges.
Invocation of API will lead to audio moderation fees and COS read request fees.
If the audio is a low-frequency storage type in COS, invoking the moderation will generate COS low-frequency data retrieval fees.
Audio files of the CAS or Deep CAS storage class in COS are not supported for moderation. To moderate these types of files, you need to first restore them as detailed in POST Object restore.


SDK Recommendation

The CI SDK has capabilities such as a complete demo, automated integration, and signature calculation. The SDK allows for a more convenient and swift way to invoke API. Refer to SDK documentation for more information.

Request

Sample Request

POST /audio/auditing HTTP/1.1
Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Content-Length: <length>
Content-Type: application/xml
<body>
Note:
Authorization: Auth String (please refer to request signature for detailed information).
When utilizing the feature via a sub-account, it is required to assign the relevant permission. For more details, please refer to the authorization granularity details document.

Request Headers

This API only utilizes the common request headers. For more information, please refer to common request headers.

Request Body

The implementation of this request action requires the following request body:
<Request>
<Input>
<Object></Object>
<Url></Url>
<DataId></DataId>
</Input>
<Conf>
<Callback></Callback>
<BizType></BizType>
</Conf>
</Request>
The specific data is described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Request
No
The specific configuration item for AAS.
Container
Yes
The specific data for the Container type Request is described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Input
Request
Content with need of moderation.
Container
Yes
Conf
Request
Moderation of rule configuration.
Container
Yes
The specific data for the Container type Input is described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Object
Request.Input
Name of the audio file stored in the COS bucket. For instance, the file audio.mp3 in the test directory is named test/audio.mp3. Either Object or Url can be selected.
String
No
Url
Request.Input
URL of the audio file, such as 'http://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/audio.mp3'. Either Object or Url can be selected.
String
No
DataId
Request.Input
This field in the moderation result will return the original content, with a length limit of 512 bytes. You can use this field to uniquely identify the data that needs moderation.
String
No
UserInfo
Request.Input
User Business field.
Container
No
Content of UserInfo in the Container Node:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
TokenId
Request.Input.UserInfo
User Business TokenId, which can contain up to 128 bytes.
String
No
Nickname
Request.Input.UserInfo
User Business Nickname, which can contain up to 128 bytes.
String
No
DeviceId
Request.Input.UserInfo
User Business DeviceId, which can contain up to 128 bytes.
String
No
AppId
Request.Input.UserInfo
User Business AppId, which can contain up to 128 bytes.
String
No
Room
Request.Input.UserInfo
User Business Room, which can contain up to 128 bytes.
String
No
IP
Request.Input.UserInfo
User Business IP, which can contain up to 128 bytes.
String
No
Type
Request.Input.UserInfo
User Business Type, which can contain up to 128 bytes.
String
No
ReceiveTokenId
Request.Input.UserInfo
User Business ReceiveTokenId, which can contain up to 128 bytes.
String
No
Gender
Request.Input.UserInfo
User Business Gender, which can contain up to 128 bytes.
String
No
Level
Request.Input.UserInfo
User Business Level, which can contain up to 128 bytes.
String
No
Role
Request.Input.UserInfo
User Business Role, which can contain up to 128 bytes.
String
No
The specific data for the Container type Conf is described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
BizType
Request.Conf
The only identifier for a moderation policy. You can configure your desired moderation scenarios on the moderation policy page on the console, such as pornography and advertising. Configuration guide: setting moderation policy. You can obtain BizType on the console. When BizType is entered, this moderation request will be moderated according to the scenarios configured in that moderation policy. When BizType is not entered, the default moderation policy will be automatically applied.
String
No
Callback
Request.Conf
The moderation result will be sent to your callback address in the form of callback, supporting the address beginning with http:// or https://, such as: http://www.callback.com.
String
No
CallbackVersion
Request.Conf
The structure of the callback content. Valid values: Simple (The callback content includes basic information) and Detail (The callback content includes detailed information). The default value is Simple.
string
No
CallbackType
Request.Conf
The callback segment type. Valid values: 1 (Callback for all the audio segments) and 2 (Callback for violation audio segments). The default value is 1.
Integer
No
Freeze
Request.Conf
This field allows settings of various scores given by the moderation result to automatically block audio files. It is only effective when the audio under review in input is object.
Container
No
The specific data for the Freeze type Container is described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
PornScore
Request.Conf.Freeze
Its value ranges from 0 to 100, which indicates that the freeze operation will be carried out automatically when the pornography moderation result equals or exceeds the given number. If the PornScore is not entered, the automatic freeze operation will not occur. The default value is null.
Integer
No
AdsScore
Request.Conf.Freeze
Its value ranges from 0 to 100, which indicates that the freeze operation will be carried out automatically when the advertising moderation result equals or exceeds the given number. If the AdsScore is not entered, the automatic freeze operation will not occur. The default value is null.
Integer
No
For freeze parameters in other moderation scenarios, please contact service staff for consultation.

Response

Response headers

This API only returns common response headers. For more information, see common response headers.

Response body

The response body returns application/xml data. The content containing the complete node data is shown as follows:
<Response>
<JobsDetail>
<DataId></DataId>
<JobId></JobId>
<State></State>
<CreationTime></CreationTime>
</JobsDetail>
<RequestId></RequestId>
</Response>
The specific data is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Response
No
The specific response content returned by AAS.
Container
Content of the Container node Response:
Node Name (Keyword)
Parent Node
Description
Type
JobsDetail
Response
Detailed information of the AAS task.
Container
RequestId
Response
Whenever a request is sent, the server will automatically create an ID for the request, which can help locate problems more quickly when it encounters problems.
String
Contents of the Container Node JobsDetail:
Node Name (Keyword)
Parent Node
Description
Type
DataId
Response.JobsDetail
The only business identifier added in the request.
String
JobId
Response.JobsDetail
ID of the AAS task.
String
State
Response.JobsDetail
State of the AAS task, the value of which can be Submitted, Success, Failed, or Auditing.
String
CreationTime
Response.JobsDetail
Creation time of the AAS task.
String

Error Code

There are no special error messages for this request operation. For ordinary error messages, please refer to the error codes document.

Actual Case

Request

POST /audio/auditing HTTP/1.1
Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0e****
Host: examplebucket-1250000000.ci.ap-beijing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Input>
<Object>a.mp3</Object>
<DataId>123-fdrsg-123</DataID>
</Input>
<Conf>
<DetectType>Porn,Ads</DetectType>
<Callback>http://callback.com/</Callback>
</Conf>
</Request>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Thu, 15 Jun 2017 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****

<Response>
<JobsDetail>
<DataId>123-fdrsg-123</DataID>
<JobId>vab1ca9fc8a3ed11ea834c525400863904</JobId>
<State>Submitted</State>
<CreationTime>2019-07-07T12:12:12+0800</CreationTime>
</JobsDetail>
<RequestId>xxxxxxxxxxxxxx</RequestId>
</Response>


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support