02 / 端點
Captions
儲存字幕 (commit)
需要 API KeyPUT/api/enterprise/v1/generated-videos/{videoId}/captions
將檢視或編輯完成的字幕儲存到影片。
- Body 中每個
clips[].index必須與影片的VideoClip.index一對一對應。 - 若不對應或格式有誤,回傳
INVALID_CAPTION_PAYLOAD(400)。 - 會在同一個 transaction 內更新各 clip 的
captionWords/captionWordGroups。
路徑參數
| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
| videoId | string | 必填 | 生成短影音 ID範例: gsv_001 |
請求內容CaptionsSaveRequest
| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
| clips[] | CaptionClipPreview[] | 必填 | 要儲存的 clip 陣列。每個 index 必須與影片的 VideoClip.index 一對一對應,且不允許重複的 index。 |
| index | number | 必填 | 與 VideoClip.index 對應 |
| segmentId | string | 必填 | |
| captionWords[] | CaptionWord[] | 必填 | |
| index | integer | 必填 | 該時間軸內的單字 index範例: 0 |
| text | string | 必填 | 字幕單字範例: hello |
| start | number | 必填 | 時間軸起始時間 (ms)。在 source 是以原始長影片為準,在 generatedVideos 則是以生成短影音為準。範例: 1200 |
| end | number | 必填 | 時間軸結束時間 (ms)。在 source 是以原始長影片為準,在 generatedVideos 則是以生成短影音為準。範例: 1450 |
| metadata | object | 選填 | 內部字幕中繼資料 |
| captionWordGroups[] | CaptionWordGroup[] | 必填 | |
| index | integer | 必填 | word group index範例: 0 |
| indexes[] | integer[] | 必填 | 群組中包含的單字 indexes範例: [0,1,2] |
請求範例
{
"clips": [
{
"index": 0,
"segmentId": "string",
"captionWords": [
{
"index": 0,
"text": "hello",
"start": 1200,
"end": 1450
}
],
"captionWordGroups": [
{
"index": 0,
"indexes": [
0,
1,
2
]
}
]
}
]
}回應
| 狀態 | 意義 |
|---|---|
| 200 | 字幕儲存成功CaptionsSaveResponse |
| 400 | 內容有誤 / clip index 不一致ErrorResponse |
| 401 | 驗證失敗ErrorResponse |
| 404 | 找不到影片ErrorResponse |
回應 200CaptionsSaveResponse
| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
| requestId | string | 必填 | |
| video | object | 必填 | |
| id | string | 必填 | |
| updatedClipCount | number | 必填 | 已儲存的 clip 數 |
| updatedAt | string | 必填 | 儲存時間 (ISO 8601) |
回應範例
{
"requestId": "string",
"video": {
"id": "string"
},
"updatedClipCount": 0,
"updatedAt": "string"
}


