Skip to main content

Generate Captions With AntCDN

Generate Captions

You can either:

  • Generate captions automatically on upload (recommended), or
  • Generate captions later via the captions API.

When requesting an upload URL, include:

  • generateCaptions: true
  • optionally captionLanguages: ["en"]
  • optionally captionTranslate: true (if you want translations generated)

This works with both:

  • POST /videos/upload-url (direct upload), and
  • POST /videos/upload (upload-from-URL)

Option 2: Generate Captions After Upload

List available captions

/videos/{assetId}/captions

Request generation for a language

/videos/{assetId}/captions

Example body:

{
"lang": "en",
"translate": false,
"overwrite": false
}

Upload your own captions

/videos/{assetId}/captions/upload

Example body:

{
"lang": "en",
"format": "vtt",
"content": "WEBVTT\n\n00:00.000 --> 00:02.000\nHello world\n",
"overwrite": true
}

Getting a Playback URL for Captions

To obtain a URL you can hand to a player:

/videos/{assetId}/captions/{lang}

Response body:

{
"url": "https://worker.antcdn.net/v1/{edgeKey}/captions/en.vtt"
}