方案價格部落格企業版API
登入免費開始
登入免費開始

02 / 端點

Captions

儲存字幕 (commit)

需要 API Key
PUT/api/enterprise/v1/generated-videos/{videoId}/captions

將檢視或編輯完成的字幕儲存到影片。

  • Body 中每個 clips[].index 必須與影片的 VideoClip.index 一對一對應。
  • 若不對應或格式有誤,回傳 INVALID_CAPTION_PAYLOAD(400)。
  • 會在同一個 transaction 內更新各 clip 的 captionWords / captionWordGroups。

路徑參數

欄位型別必填說明
videoIdstring必填生成短影音 ID範例: gsv_001

請求內容CaptionsSaveRequest

欄位型別必填說明
clips[]CaptionClipPreview[]必填要儲存的 clip 陣列。每個 index 必須與影片的 VideoClip.index 一對一對應,且不允許重複的 index。
indexnumber必填與 VideoClip.index 對應
segmentIdstring必填
captionWords[]CaptionWord[]必填
indexinteger必填該時間軸內的單字 index範例: 0
textstring必填字幕單字範例: hello
startnumber必填時間軸起始時間 (ms)。在 source 是以原始長影片為準,在 generatedVideos 則是以生成短影音為準。範例: 1200
endnumber必填時間軸結束時間 (ms)。在 source 是以原始長影片為準,在 generatedVideos 則是以生成短影音為準。範例: 1450
metadataobject選填內部字幕中繼資料
captionWordGroups[]CaptionWordGroup[]必填
indexinteger必填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

欄位型別必填說明
requestIdstring必填
videoobject必填
idstring必填
updatedClipCountnumber必填已儲存的 clip 數
updatedAtstring必填儲存時間 (ISO 8601)
回應範例
{
  "requestId": "string",
  "video": {
    "id": "string"
  },
  "updatedClipCount": 0,
  "updatedAt": "string"
}