视频翻译
视频翻译 API 将视频画面中的嵌字(字幕、卖点文字等)翻译为目标语言,并擦除原文。适用于电商视频多语言分发、国际社交媒体营销、全球品牌广告投放等场景。API 采用异步调用模式:提交翻译任务后获取 task_id,通过查询接口轮询任务状态直至完成后获取结果。
适用场景
-
跨境电商视频本地化:将商品介绍视频中的卖点文字翻译为目标市场语言,助力海外平台推广。
-
国际社交媒体营销:针对 TikTok、Instagram、YouTube 等平台,将视频画面文字内容一键本地化,提升海外用户理解度与转化率。
-
全球品牌广告投放:根据投放地区语言自动生成对应版本视频,减少人工制作成本。
-
培训与产品说明:将培训课程或产品演示视频中的画面文字翻译为多语言版本,方便全球团队使用。
功能介绍
|
能力 |
标识码 |
说明 |
|
画面翻译 |
|
翻译视频画面中的嵌字(字幕、卖点文字等),并擦除原文。 |
提交翻译任务
请求
POST /api/v1/video/translation
请求参数
|
参数名 |
类型 |
必填 |
说明 |
|
|
String |
是 |
源视频 URL。支持 MP4 / MOV 格式,大小 ≤ 200 MB。 |
|
|
Array<String> |
是 |
翻译能力数组,当前可选值: |
|
|
String |
是 |
目标语言代码,见下方「语言支持」。 |
|
|
String |
否 |
源语言代码,默认 |
请求示例
POST /api/v1/video/translation
{
"videoUrl": "https://cdn.example.com/product-demo.mp4",
"capabilities": ["visual"],
"targetLanguage": "en",
"sourceLanguage": "zh"
}
响应参数
|
参数名 |
类型 |
说明 |
|
|
String |
状态码, |
|
|
String |
说明信息。 |
|
|
String |
请求追踪 ID。 |
|
|
String |
任务唯一标识,用于查询结果。 |
响应示例
{
"code": "Success",
"message": "Translation task submitted successfully",
"request_id": "req_20260608_abc123",
"data": {
"task_id": "task_7f3a9b2e-4c1d-4e8f-b6a5-1234567890ab"
}
}
查询翻译结果
请求
GET /api/v1/video/translation/{task_id}
|
参数名 |
位置 |
类型 |
说明 |
|
|
path |
String |
提交接口返回的任务 ID。 |
响应参数
|
参数名 |
类型 |
说明 |
|
|
String |
状态码。 |
|
|
String |
说明信息。 |
|
|
String |
请求追踪 ID。 |
|
|
String |
任务 ID。 |
|
|
String |
任务状态: |
|
|
Int |
任务处理中。 |
|
|
Object |
翻译结果(仅 |
|
|
String |
译后视频下载 URL(有效期 30 天)。 |
|
|
Number |
输出视频时长(秒)。 |
|
|
Object |
错误信息(仅 |
响应示例(任务处理中)
{
"code": "Processing",
"message": "Translation processing",
"request_id": "req_20260608_jkl012",
"data": {
"task_id": "task_7f3a9b2e-4c1d-4e8f-b6a5-1234567890ab",
"status": "in_progress"
}
}
响应示例(完成)
{
"code": "Success",
"message": "Translation completed",
"request_id": "req_20260608_ghi789",
"data": {
"task_id": "task_7f3a9b2e-4c1d-4e8f-b6a5-1234567890ab",
"status": "completed",
"results": {
"video_url": "https://cdn.example.com/output/task_7f3a9b2e.mp4",
"duration": 125.4
}
}
}
响应示例(失败)
{
"code": "Success",
"message": "Translation failed",
"request_id": "req_20260608_jkl012",
"data": {
"task_id": "task_7f3a9b2e-4c1d-4e8f-b6a5-1234567890ab",
"status": "failed",
"error": {
"error_code": "PROCESSING_TIMEOUT",
"error_message": "任务处理超时,请重试",
"retryable": true
}
}
}
语言支持
视频翻译当前支持 29 个源语言与 23 个目标语言,源语言与目标语言独立选择。sourceLanguage 不传或传 auto 时由系统自动识别;传具体语言代码时按该语言强制识别(跳过自动识别)。完整语言名称与代码见 语向映射「视频翻译支持语言」。
错误码
|
错误码 |
Message |
备注 |
|
|
The video format is not supported, please use MP4/MOV. |
|
|
|
The video duration exceeds the maximum limit (3 minutes). |
|
|
|
The video file size exceeds the maximum limit (200MB). |
|
|
|
Failed to download video from the provided URL. |
|
|
|
The specified language combination is not supported. |
|
|
|
Invalid request parameter: %s |
|
|
|
Caller type not supported: %s (only main account 'customer' and sub-account 'sub' are allowed) |
|
|
|
用户状态异常: %s |
|
|
|
Service not activated, please activate the service first: %s |
|
|
|
Service status abnormal, please contact the administrator: %s |
|
|
|
Service suspended due to overdue payment, please settle the payment and retry: %s |
|
|
|
Free quota exhausted; disable the 'stop-when-exhausted' switch or purchase a package: %s |
|
|
|
Request priority unavailable: %s |
|
|
|
Input content violates policy, please modify and retry: %s |
|
|
|
Output content violates policy: %s |
|
|
|
Service temporarily unavailable, details: %s |
|
|
|
Internal system error: %s |
|
|
|
Internal system error: %s |
|
|
|
System is busy, please retry later: %s |
|
|
|
The request has failed due to a temporary failure of the server. |
|
|
|
Request was denied due to flow control. |
|
|
|
Request was denied due to api flow control. |
|
|
|
Request was denied due to user flow control. |
|
|
|
You are not authorized to perform this action. |
|
|
|
The request processing has failed due to some unknown error. |
|
|
|
The request processing has failed due to some unknown error. |
|
|
|
The specified parameter “%s” is not valid. |
|
|
|
The request signature does not conform to Alibaba Cloud standards. |
|
|
|
XXXXX is mandatory for this action. |
其他错误码参照 Aidge 平台统一错误码。
使用限制
|
项目 |
限制 |
|
视频格式 |
MP4、MOV |
|
视频大小 |
≤ 200 MB |
|
结果查询有效期 |
7 天(过期后需重新提交) |
常见问题
提交任务后多久可以获取结果?
处理时长与视频时长相关,一般在视频时长的同量级范围内。可通过查询接口的 progress 字段了解实时进度。
任务失败后如何重试?
查询结果中 error.retryable = true 的错误可直接用相同参数重新提交任务。每次提交都会生成新的 task_id。