

{"InputInfo":{ //Input video path. Replace it with the path of your original video."Type":"URL","UrlInputInfo":{"Url":"https://test-1234567.cos.ap-nanjing.myqcloud.com/mps_test/myvideo.mp4"}},"OutputStorage":{ //Output Cloud Object Storage (COS) bucket. Replace it."Type":"COS","CosOutputStorage":{"Bucket":"test","Region":"ap-nanjing"}},"OutputDir":"/mps_test/output/",//Output folder path. Replace it."AiAnalysisTask":{"Definition":32, //Preset template ID. Enter 32."ExtendedParameter":"{\\"dubbing\\":{\\"speakerUrl\\":\\"https://mycloud.com/path/to/file.json\\"}}" //Required extension parameter. It is used to specify the speaker file path, subtitle style, and other parameters.},"TaskNotifyConfig":{ //Event callback notification configuration, which is optional."NotifyType":"URL","NotifyUrl":"http://www.qq.com/callback"}}


{\\"dubbing\\":{\\"speakerUrl\\":\\"https://mycloud.com/path/to/file.json\\"}}
ExtendedParameter is used for customizing settings of AI dubbing tasks. All optional parameters and their descriptions are as follows:Parameter | Type | Required | Description |
speakerUrl | string | 否 | Either Speaker File URL or Subtitle URLs must be provided. For details, please refer to the Speaker Data Format. |
srcLang | string | 否 | Source language. Optional when using speakerUrl mode. |
dstLangs | list<string> | 否 | Target dubbing languages. Optional when using speakerUrl mode. |
subtitleUrls | json | 否 | Input subtitle URLs. Either this or speakerUrl must be provided. |
subtitleUrls.srcSubtitleUrl | string | 否 | Original subtitle URL. |
subtitleUrls.dstSubtitleUrls | json | 否 | Target subtitle URLs, with language as key and subtitle URL as value. |
subtitle | json | 否 | Parameters related to output subtitles. |
subtitle.embed | bool | 否 | Whether to embed subtitles. Enabled by default. |
subtitle.style | json | 否 | Subtitle styling. Takes effect when subtitle embedding is enabled. |
subtitle.style.font | string | 否 | Font family. Uses default font when empty or set to "auto". For supported fonts, refer to SubtitleTemplate Data Structure. |
subtitle.style.fontSize | float | 否 | Font size. Default: 50 px. |
subtitle.style.marginV | float | 否 | Bottom margin. Default: 50 px. |
outputPattern | string | 否 | Output filename prefix. If not specified, defaults to "dub", with full filename as dub_{unixtime}.{format}. |
{"dubbing": {"speakerUrl": "https://mycloud.com/path/to/file.json", // Required. The Speaker file URL."subtitle": {"embed": true, // Specify whether to embed subtitles. true by default."style": { // The subtitle style. This parameter is valid only when subtitle embedding is enabled."font": "kai.ttf", // The font. Default value: "kai.tff"."fontSize": 50, // The font size. Default value: 50px."marginV": 50 // The bottom margin. Default value: 50.}},"outputPattern": "filename" // Optional. The prefix of the output file name.}}
{"dubbing": {"srcLang": "zh","dstLangs": ["ja"],"subtitleUrls": {"srcSubtitleUrl": "https://test/zh.vtt", // Original-language subtitle URL."dstSubtitleUrls": {"ja": "https://test/ja.vtt" // Target-language subtitle URL.}},"subtitle": {"embed": true, // Specify whether to embed subtitles. true by default."style": { // The subtitle style. This parameter is valid only when subtitle embedding is enabled."font": "auto", // The font. auto means automatic matching based on subtitle language."fontSize": 0.04, // The font size. A value less than 1 represents a percentage."marginV": 0.15 // The bottom margin. A value less than 1 represents a percentage.}},"outputPattern": "filename" // Optional. The prefix of the output file name.}}
{"SrcLang": "zh","DstLangs": ["en"],"Speakers": [{"Id": "speaker_0","Gender": "male"},{"Id": "speaker_1","Gender": "female"}],"Clips": [{"TextStartTime": "00:00:00.100","TextEndTime": "00:00:00.600","SpeakerId": "speaker_0","SrcText": "没谁","DstTexts": {"en": "No one"}},{"TextStartTime": "00:00:01.0","TextEndTime": "00:00:01.200","SpeakerId": "speaker_1","SrcText": "早上好""DstTexts": {"en": "Morning"}}]}
Parameter | Required | Type | Description |
SrcLang | Yes | string | |
DstLangs | Yes | list<string> | Target language for translation. Currently, only a single language can be selected. For details, see Supported Languages. |
Speakers[i].Id | Yes | string | Speaker ID. |
Speakers[i].Gender | Yes | string | Speaker gender. Valid values: male and female. |
Clips[i].TextStartTime | Yes | string | Start timestamp of the subtitle clip. Format: hh:mm:ss.ms. |
Clips[i].TextEndTime | Yes | string | End timestamp of the subtitle clip. Format: hh:mm:ss.ms. |
Clips[i].SpeakerId | Yes | string | Speaker ID corresponding to the subtitle clip. |
Clips[i].SrcText | Yes | string | Source language of the subtitle slice. |
Clips[i].DstTexts | Yes | map<string,string> | Target language of the subtitle slice. Currently, only a single language can be selected. |



Language | Code | Supported as Source Language (SrcLang) | Supported as Target Language (DstLangs) |
Chinese | zh | ✓ | ✓ |
English | en | ✓ | ✓ |
Japanese | ja | ✓ | ✓ |
German | de | ✓ | ✓ |
French | fr | ✓ | ✓ |
Korean | ko | ✓ | ✓ |
Russian | ru | ✓ | ✓ |
Ukrainian | uk | ✓ | ✓ |
Portuguese | pt | ✓ | ✓ |
Italian | it | ✓ | ✓ |
Spanish | es | ✓ | ✓ |
Indonesian | id | ✓ | ✓ |
Dutch | nl | ✓ | ✓ |
Turkish | tr | ✓ | ✓ |
Filipino | fil | ✓ | ✓ |
Malay | ms | ✓ | ✓ |
Greek | el | ✓ | ✓ |
Finnish | fi | ✓ | ✓ |
Croatian | hr | ✓ | ✓ |
Slovak | sk | ✓ | ✓ |
Polish | pl | ✓ | ✓ |
Swedish | sv | ✓ | ✓ |
Hindi | hi | ✓ | ✓ |
Bulgarian | bg | ✓ | ✓ |
Romanian | ro | ✓ | ✓ |
Arabic | ar | ✓ | ✓ |
Czech | cs | ✓ | ✓ |
Danish | da | ✓ | ✓ |
Tamil | ta | ✓ | ✓ |
Hungarian | hun | ✓ | ✓ |
Vietnamese | vi | ✓ | ✓ |



python3 subtitle2speaker.py input.srt output.json --src_lang "zh" --dst_langs "en"
python3 subtitle2speaker.py input_src.vtt input_dst.vtt output.json --src_lang "zh" --dst_langs "en"
Feedback