Overview
Menu

CreateSmartSubtitleTemplate

Last updated: 2026-07-02 11:34:51Download PDF

1. API Description

Domain name for API request: mps.intl.tencentcloudapi.com.

This API is used to create a custom smart subtitle template.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter NameRequiredTypeDescription
ActionYesStringCommon Params. The value used for this API: CreateSmartSubtitleTemplate.
VersionYesStringCommon Params. The value used for this API: 2019-06-12.
RegionNoStringCommon Params. This parameter is not required for this API.
NameYesString

Intelligent subtitle template name
Length limit: 64 characters.

VideoSrcLanguageYesString

Smart subtitling video source language.

For ASR and subtitle translation parameter values, see ASR Languages.

The following lists some commonly used values:

auto: automatic identification. zh: Simplified Chinese. en: English. ja: Japanese. ko: Korean. zh-PY: Chinese, English, and Cantonese. zh_medical: Chinese health care. vi: Vietnamese. ms: Malay. id: Indonesian. fil: Filipino. th: Thai. pt: Portuguese. tr: Turkish. ar: Arabic. es: Spanish. hi: Hindi. fr: French. de: German. it: Italian. zh_dialect: Chinese dialect. zh_en: Chinese and English. yue: Cantonese. ru: Russian. prime_zh: Chinese and English dialects.

OCR only supports the following values:

zh_en: Chinese and English
multi: others

For languages supported by different values, see OCR Languages

SubtitleTypeYesInteger

Intelligent caption subtitle language type
0: Source language
1: Target language
2: Source language + target language
Only 0 is supported when TranslateSwitch is OFF
Only 1 or 2 is supported when TranslateSwitch is ON

CommentNoString

Intelligent caption template description information
Length limit: 256 characters.

SubtitleFormatNoString

Intelligent subtitle file format:

  • For ASR recognition translation processing type:
    • vtt: WebVTT format subtitle
    • srt: SRT format subtitle
    • Leave blank or fill in the blank: no subtitle file generated
  • For pure subtitle translation processing type:
    • original: consistent with the source file
    • vtt: WebVTT format subtitle
    • srt: SRT format subtitle
  • For OCR recognition translation processing type:
    • vtt: WebVTT format subtitle
    • srt: SRT format subtitle

Note:

  • For ASR recognition method, do not leave blank or not pass when translating 2 or more languages.
  • For pure subtitle translation method, do not leave blank or not pass.
  • For OCR tasks, it is allowed to leave blank or not pass when suppression is enabled.
AsrHotWordsConfigureNoAsrHotWordsConfigure

ASR hot word lexicon parameter

TranslateSwitchNoString

Subtitle translation switch
ON: Enable translation
OFF: Disable translation

Note: For pure subtitle translation mode, the default value is enabled if the field is unspecified. The field cannot be left blank or set to OFF.

TranslateDstLanguageNoString

This parameter takes effect when the value of TranslateSwitch is ON. Valid translation languages:

For ASR extraction and translation, see ASR Translation Languages.
For OCR extraction and translation, see OCR Translation Languages.

Note: Use / to separate multiple languages, such as en/ja, which indicates English and Japanese.

Examples of some commonly used languages:

ar: Arabic
en: English
fr: French
it: Italian
ja: Japanese
ko: Korean
ru: Russian
th: Thai
tr: Turkish
vi: Vietnamese
yue: Cantonese
zh: Simplified Chinese
zh-TW: Traditional Chinese

ProcessTypeNoInteger

Subtitle processing type:

  • 0: ASR recognition subtitle
  • 1: Pure caption translation
  • 2: OCR recognition subtitle

Note: The default type is ASR recognition subtitle if the field is unspecified.

SelectingSubtitleAreasConfigNoSelectingSubtitleAreasConfig

Area configurations for the subtitle OCR extraction box

SubtitleEmbedIdNoInteger

Suppression Template id. Only allowed to fill in when ProcessType is 0 or 2 (task type is ASR or OCR). Cannot fill in when multiple target languages are enabled.

SpeakerModeNoInteger

Speaker identification switch. Valid values:
0: Speaker identification is disabled.
1: Speaker identification is enabled.
By default, speaker identification is disabled.

SpeakerLabelNoInteger

Indicates whether to output the identified speaker to the subtitle file. Valid values:
0: The speaker is not output to the subtitle file.
1: The speaker is output to the VTT subtitle file.
Note: To use this parameter, the value of SpeakerMode cannot be 0.
By default, the speaker is not output to the subtitle file.

3. Output Parameters

Parameter NameTypeDescription
DefinitionInteger

Unique identifier of the smart subtitle template.

RequestIdStringThe unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Creating a Smart Subtitle Template

Input Example

POST / HTTP/1.1
Host: mps.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateSmartSubtitleTemplate
<Common request parameters>

{
    "Name": "Smart Subtitle Template Test"
    "VideoSrcLanguage": "zh",
    "SubtitleType": 2,
    "SubtitleFormat": "vtt",
    "TranslateSwitch": "ON",
    "TranslateDstLanguage": "en/ja",
    "SubtitleEmbedId": 0
}

Output Example

{
    "Response": {
        "Definition": 304479,
        "RequestId": "92b23ad2-452e-4887-927e-7b4cc9325538"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error CodeDescription
InvalidParameterValue.AsrHotWordsConfigureThe value of the hotword lexicon configuration parameter is incorrect.
InvalidParameterValue.AsrHotWordsLibraryIdThe value of the hotword lexicon ID parameter is incorrect.
InvalidParameterValue.AsrHotWordsSwitchThe value of the hotword lexicon switch parameter is incorrect.
InvalidParameterValue.CommentParameter error: template description.
InvalidParameterValue.NameIncorrect parameter value: Name exceeds the length limit.
InvalidParameterValue.SubtitleEmbedIdSubtitle suppression ID invalid
InvalidParameterValue.SubtitleFormatIncorrect parameter value: The value of the SubtitleFormat parameter is invalid.
InvalidParameterValue.SubtitleTypeThe value of the subtitle language type is incorrect.
InvalidParameterValue.TranslateDstLanguageThe value of the target language parameter is incorrect.
InvalidParameterValue.TranslateSwitchThe value of the translation switch parameter is incorrect.
InvalidParameterValue.VideoSrcLanguageThe value of the video source language parameter is incorrect.