视频翻译 API 支持将视频中的语音和画面文字翻译为目标语言。您可以单独选择语音字幕翻译、画面文字翻译,或同时选择两种能力。适用于电商视频多语言分发、国际社交媒体营销、全球品牌广告投放等场景。API 采用异步调用模式:提交翻译任务后获取 TaskId,通过查询接口轮询任务状态直至完成后获取结果。
适用场景
跨境电商视频本地化:将商品介绍视频中的语音字幕和卖点文字翻译为目标市场语言,助力海外平台推广。
国际社交媒体营销:针对 TikTok、Instagram、YouTube 等平台,将语音字幕和视频画面文字内容一键本地化,提升海外用户理解度与转化率。
全球品牌广告投放:根据投放地区语言自动生成对应版本视频,减少人工制作成本。
培训与产品说明:将培训课程或产品演示视频中的语音字幕和画面文字翻译为多语言版本,方便全球团队使用。
功能介绍
能力 | 标识码 | 说明 |
语音字幕翻译 |
| 将视频语音翻译为目标语言配音;可选择“仅消除原字幕”或“替换为翻译后的字幕”;默认不处理原字幕、不添加新字幕 |
画面文字翻译 |
| 翻译画面中的源语言文字,或仅消除画面文字,不翻译;可选择消除品牌标识(Logo) |
语音字幕翻译(speech)以视频中的说话内容为基础,生成目标语言配音,并按原字幕处理选项完成字幕处理后合成为视频。“原字幕”指视频画面中已有、与说话内容对应的字幕;“替换为翻译后的字幕”会先消除原字幕,再添加与翻译后语音同步的字幕。
画面文字翻译(visual)针对视频画面中可识别的原视频语言文字,例如标题、商品卖点和说明文字。它可以单独使用,无需先选择语音字幕翻译;也不要求这些文字在语音中出现。处理范围内的原字幕同样可能被处理。
同时选择 speech 和 visual 时,先完成语音字幕翻译并合成视频,再在该视频上执行画面文字处理,保留翻译后的配音,输出一个最终视频。数组中的能力顺序不影响执行顺序。因此,不处理原字幕仅表示语音字幕阶段不消除、不新增字幕,后续画面文字处理仍可能改变原字幕。已替换为翻译后的字幕会在后续画面文字处理中保留。
开发指南
1. 提交翻译任务
请求
POST /api/v1/video/translation
参数名 | 类型 | 必填 | 说明 | 示例值 |
VideoUrl | String | 是 | 视频地址(MP4/MOV,≤ 200MB) | https://cdn.example.com/product-demo.mp4 |
Capabilities | 字符串数组 | 是 | 翻译能力列表:speech、visual,支持同时选择;至少一项,不接受重复值 | ["speech", "visual"] |
TargetLanguage | String | 条件必填 | 包含 speech 时始终必填;仅 visual 且 EraseOnly=true 时可不传,传入则忽略;其他情况必填 | en |
SourceLanguage | String | 否 | 原视频语言(源语言),支持范围见“语言支持” | zh |
SubtitleMode | String | 否 | 仅包含 speech 时可传;erase:仅消除原字幕;replace:替换为翻译后的字幕,即消除原字幕并添加与翻译后语音同步的字幕;不传:不处理原字幕,即不消除原字幕,也不添加新字幕 | replace |
EraseOnly | Boolean | 否 | 仅包含 visual 时可传;true:仅消除画面文字,不翻译;false:翻译画面文字。默认 false | false |
RemoveLogo | Boolean | 否 | 仅包含 visual 时可传;true:消除品牌标识(Logo);false:保留品牌标识(Logo)。默认 false;与 EraseOnly 独立 | false |
EnableQualityCheck | Boolean | 否 | 默认 false。包含visual 且显式传true 时启用画面文字处理质检;仅选择 speech 时忽略此参数,不执行质检、不返回质检字段,也不因该参数报错。开启质检可能延长等待时间,如无必要建议不开启 | true |
SubtitleMode 不影响语音翻译。replace 添加的新字幕采用系统默认字体、大小和位置,并与目标语言配音对应;后续画面处理保留这些新字幕。没有原字幕但存在有效语音时,replace 仍可添加目标语言字幕。
EraseOnly 只作用于源语言画面文字,不关闭语音翻译或字幕处理;双选时即使 EraseOnly=true,仍必须提供 TargetLanguage。语音和画面共用同一组源语言、目标语言。
新增布尔参数只接受 true 或 false,默认行为通过省略参数获得,不接受 null、空字符串或未定义的枚举。无 speech 时传 SubtitleMode、无 visual 时传 EraseOnly/RemoveLogo(包括 false),均返回 InvalidParameter。
请求示例
语音字幕翻译,不处理原字幕
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech"
],
"TargetLanguage": "en",
"SourceLanguage": "zh"
}
语音字幕翻译,仅消除原字幕
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "erase"
}
语音字幕翻译,替换为翻译后的字幕
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "replace"
}
画面文字翻译
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh"
}
仅消除画面文字,不翻译
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"visual"
],
"SourceLanguage": "zh",
"EraseOnly": true
}
画面文字翻译,消除品牌标识(Logo)
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"RemoveLogo": true
}
语音字幕翻译和画面文字翻译
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh"
}
消除原字幕,并翻译语音和画面文字
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "erase"
}
替换为翻译后的字幕,并翻译语音和画面文字
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "replace"
}
替换为翻译后的字幕,翻译语音,仅消除画面文字
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "replace",
"EraseOnly": true
}
替换为翻译后的字幕,翻译语音和画面文字,消除品牌标识(Logo)
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "replace",
"EraseOnly": false,
"RemoveLogo": true
}
替换为翻译后的字幕,翻译语音和画面文字,消除品牌标识(Logo)并开启质检
{
"VideoUrl": "https://cdn.example.com/product-demo.mp4",
"Capabilities": [
"speech",
"visual"
],
"TargetLanguage": "en",
"SourceLanguage": "zh",
"SubtitleMode": "replace",
"EraseOnly": false,
"RemoveLogo": true,
"EnableQualityCheck": true
}
2. 查询翻译结果
请求
GET /api/v1/video/translation/{TaskId}
参数名 | 位置 | 类型 | 必填 | 说明 |
TaskId | path | String | 是 | 提交接口返回的任务 ID |
响应参数
参数名 | 类型 | 说明 |
Code | String | 状态码 |
Data.TaskId | String | 异步任务 ID,用于后续查询 |
Message | String | 说明信息 |
RequestId | String | 请求追踪 ID |
Success | boolean | 是否调用成功; true:调用成功 false:调用失败 |
语音字幕或画面文字处理执行失败时,任务状态为 failed。双选返回全部所选步骤完成后的最终视频。
响应示例 — 任务处理中
{
"Data": {
"Status": "IN_PROGRESS",
"TaskId": "vtj_053c17758bf04064896d107d1b787319"
},
"Message": "Success",
"RequestId": "01A15744-EEE5-58A0-8B51-291052C7B689",
"Code": "success",
"Success": true
}响应示例 — 完成
{
"Data": {
"Status": "COMPLETED",
"UsageMap": {
"SubtitleTranslationSeconds": 0,
"SpeechTranslationSeconds": 14,
"LipsyncTranslationSeconds": 0,
"VisualTranslationSeconds": 0
},
"TaskId": "vtj_053c17758bf04064896d107d1b787319",
"Result": "{\"duration\":14.0,\"videoUrl\":\"<视频地址>\",\"resultUrl\":\"<视频地址>\",\"targetAudioUrl\":\"<译后音频地址>\"}"
},
"Message": "Success",
"RequestId": "01A15746-36D5-5D2D-AD03-233899637E9B",
"Code": "success",
"Success": true
}响应示例 — 失败
{
"Code": "Success",
"Message": "Translation failed",
"RequestId": "req_20260608_jkl012",
"Data": {
"TaskId": "task_7f3a9b2e-4c1d-4e8f-b6a5-1234567890ab",
"Status": "failed",
"Error": {
"ErrorCode": "PROCESSING_TIMEOUT",
"ErrorMessage": "任务处理超时,请重试",
"Retryable": true
}
}
}
语言支持
✓ 表示支持,— 表示不支持。同时选择 visual 和 speech 时,源语言和目标语言分别取两种能力的交集,不支持的语言组合返回 LangNotSupported。
1. 源语言
不传时系统将默认为中文;传具体语言代码时按该语言强制识别。
语言代码 | 语言名称 | visual | speech | visual + speech |
zh | 中文 | ✓ | ✓ | ✓ |
en | 英语 | ✓ | ✓ | ✓ |
ja | 日语 | — | ✓ | — |
ko | 韩语 | — | ✓ | — |
yue | 粤语 | — | ✓ | — |
de | 德语 | — | ✓ | — |
fr | 法语 | — | ✓ | — |
es | 西班牙语 | — | ✓ | — |
pt | 葡萄牙语 | — | ✓ | — |
ru | 俄语 | — | ✓ | — |
tr | 土耳其语 | — | ✓ | — |
2. 目标语言
语言代码 | 语言名称 | visual | speech | visual + speech |
zh | 中文 | ✓ | ✓ | ✓ |
en | 英语 | ✓ | ✓ | ✓ |
ja | 日语 | ✓ | ✓ | ✓ |
ko | 韩语 | ✓ | ✓ | ✓ |
ar | 阿拉伯语 | ✓ | ✓ | ✓ |
de | 德语 | ✓ | ✓ | ✓ |
es | 西班牙语 | ✓ | ✓ | ✓ |
fr | 法语 | ✓ | ✓ | ✓ |
hi | 印地语 | ✓ | — | — |
id | 印度尼西亚语 | ✓ | ✓ | ✓ |
it | 意大利语 | ✓ | — | — |
ms | 马来语 | ✓ | ✓ | ✓ |
nl | 荷兰语 | ✓ | — | — |
pl | 波兰语 | ✓ | — | — |
pt | 葡萄牙语 | ✓ | ✓ | ✓ |
ru | 俄语 | ✓ | ✓ | ✓ |
th | 泰语 | ✓ | ✓ | ✓ |
tl | 菲律宾语 | ✓ | — | — |
tr | 土耳其语 | ✓ | ✓ | ✓ |
uk | 乌克兰语 | ✓ | — | — |
ur | 乌尔都语 | ✓ | — | — |
vi | 越南语 | ✓ | ✓ | ✓ |
bn | 孟加拉语 | ✓ | — | — |
zh-tw | 繁体中文 / 台湾中文 | — | ✓ | — |
yue | 粤语 | — | ✓ | — |
sichuan | 四川话 | — | ✓ | — |
dongbei | 东北话 | — | ✓ | — |
tianjin | 天津话 | — | ✓ | — |
shaanxi | 陕西话 | — | ✓ | — |
方言项使用业务自定义语言代码;例如陕西话使用 shaanxi。
错误码
Code | Message | 备注 |
InvalidVideoFormat | The video format is not supported, please use MP4/MOV. | |
VideoTooLong | The video duration exceeds the maximum limit (3 minutes). | |
VideoTooLarge | The video file size exceeds the maximum limit (200MB). | |
VideoDownloadFailed | Failed to download video from the provided URL. | |
LangNotSupported | The specified language combination is not supported. | |
InvalidParameter | Invalid request parameter: %s | |
CallerTypeNotSupported | Caller type not supported: %s (only main account 'customer' and sub-account 'sub' are allowed) | |
UserStatusInvalid | 用户状态异常: %s | |
ServiceNotOpened | Service not activated, please activate the service first: %s | |
ServiceStatusInvalid | Service status abnormal, please contact the administrator: %s | |
ServiceSuspended | Service suspended due to overdue payment, please settle the payment and retry: %s | |
FreeQuotaExhausted | Free quota exhausted; disable the 'stop-when-exhausted' switch or purchase a package: %s | |
PriorityUnavailable | Request priority unavailable: %s | |
InputContentBlocked | Input content violates policy, please modify and retry: %s | |
OutputContentBlocked | Output content violates policy: %s | |
DownstreamUnavailable | Service temporarily unavailable, details: %s | |
UsageParseFail | Internal system error: %s | |
BillingPushFail | Internal system error: %s | |
InternalError | System is busy, please retry later: %s | |
ServiceUnavailable | The request has failed due to a temporary failure of the server. | |
Throttling | Request was denied due to flow control. | |
Throttling.Api | Request was denied due to api flow control. | |
Throttling.User | Request was denied due to user flow control. | |
NoPermission | You are not authorized to perform this action. | |
UnknownError | The request processing has failed due to some unknown error. | |
InternalError | The request processing has failed due to some unknown error. | |
InvalidParameter | The specified parameter ”%s” is not valid. | |
IncompleteSignature | The request signature does not conform to Alibaba Cloud standards. | |
MissingXXXXX | XXXXX is mandatory for this action. |
使用限制
项目 | 限制 |
视频格式 | MP4, MOV |
视频大小 | ≤ 200MB |
结果查询有效期 | 7 天(过期后需重新提交) |
常见问题
Q: 提交任务后多久可以获取结果?
处理时长与视频时长相关,一般在视频时长的同量级范围内。可通过查询接口的 Progress 字段了解实时进度。
Q: 任务失败后如何重试?
查询结果中 Error.Retryable = true 的错误可直接用相同参数重新提交任务。每次提交都会生成新的 TaskId。
计费方式
国际站按所选能力计费,同时选择两种能力时,单价直接叠加。
能力 | 标识码 | 单价 |
语音字幕翻译 | speech | $0.015/秒 |
画面文字翻译 | visual | $0.024/秒 |
语音字幕翻译和画面文字翻译 | speech + visual | $0.039/秒($0.015 + $0.024) |