Subtitles
Transcodely supports flexible subtitle processing as part of your transcoding outputs. You can pass through existing subtitle tracks, convert between formats, burn subtitles directly into the video, extract embedded subtitles as sidecar files, or generate captions automatically from the audio track.
Subtitle tracks are configured in the subtitle_tracks array of an Output Specification. Each output can include up to 8 subtitle tracks.
The SubtitleTrack object
| Attribute | Type | Required | Description |
|---|---|---|---|
operation | enum | Yes | Subtitle operation. One of: passthrough, convert, burn_in, extract, generate. See Operations. |
source_stream_index | integer | One of | Index of the subtitle stream in the input file (0—31). Mutually exclusive with source_url. Not used by generate (captions come from the audio). |
source_url | string | One of | URL to an external subtitle file. Supported schemes: gs://, s3://, https://. Mutually exclusive with source_stream_index. Max 2048 characters. Not used by generate. |
input_format | enum | No | Input subtitle format. One of: srt, webvtt, ttml, ass. Auto-detected when omitted. |
output_format | enum | No | Output subtitle format. One of: srt, webvtt, ttml, ass. Required for convert. Optional for extract, where it specifies the sidecar file format. For generate, one of webvtt or srt (defaults to webvtt). |
language | string | No | ISO 639-2 three-letter language code (e.g., eng, spa, fra, deu). For generate, may also be auto (or omitted) to auto-detect the spoken language. |
label | string | No | Human-readable label (e.g., "English", "Spanish (Latin America)"). Max 64 characters. |
is_default | boolean | No | Mark as the default subtitle track for the player. |
hearing_impaired | boolean | No | Flag for hearing-impaired / closed caption tracks (SDH). |
forced | boolean | No | Flag for forced subtitles (e.g., foreign-language dialogue in an otherwise native-language film). |
burn_in_style | object | No | Styling for burn-in subtitles. Only valid when operation is burn_in. See Burn-in styling. |
transcript | object | No | Transcript options. Only valid with generate. Every generate track writes its transcript in three renditions (json, txt, md) whether or not this is set. style chooses how the txt and md renditions are written: clean (default) or literal. Included in the captions fee. See Transcripts & Insights. |
insights | object | No | AI insights over the generated transcript. Only valid with generate. enabled runs the pass; hint (at most 300 characters) steers the tone and audience; glossary (one term per line, at most 4000 characters, a wrong spelling to replace in parentheses) pins the spellings of names and terms, both in the correction pass over the captions and in the insights text. Opt-in and billed at €0.05 per video + €0.005 per source minute at list price; failed insights are not charged. The transcript text (never the audio or video) is sent to Anthropic. See Transcripts and insights. |
translations | array of strings | No | Also translate the generated captions into these languages: ISO 639-2 codes, at most 10, distinct, each different from language. Only valid with generate. When language is auto, a target equal to the detected language is skipped and not billed. See Translating generated captions. Billed at €0.02 per source minute per delivered language (minimum €0.05 per video per language) at list price. Requesting a translation also enables the AI correction pass, and the caption text (never the audio or video) is sent to Anthropic. |
cue_style | object | No | How the generated captions are cut into cues: how much text one cue holds and how long it stays on screen. Only valid with generate. Omitted: the app’s default cue_style, else standard. Translations keep the source cue timing, so they follow this style too. No effect on pricing. See Caption style. |
generate_chapters | boolean | No | Deprecated: use insights.enabled. true behaves exactly like insights.enabled = true (chapters are one section of the insights) and is billed the same way. Only valid with generate. |
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/english.srt",
"input_format": "srt",
"output_format": "webvtt",
"language": "eng",
"label": "English",
"is_default": true
}Operations
Each subtitle track requires exactly one operation that determines how Transcodely processes it.
| Operation | Description | Source | Output |
|---|---|---|---|
passthrough | Copy the subtitle track to the output without modification. | source_stream_index or source_url | Preserves original format. |
convert | Convert between subtitle formats. | source_stream_index or source_url | output_format required. |
burn_in | Render subtitles directly into the video frames. Produces a hard-subbed video — subtitles cannot be turned off by the viewer. | source_stream_index or source_url | No sidecar file produced. burn_in_style optional. |
extract | Extract an embedded subtitle stream as a standalone sidecar file. | source_stream_index only | output_format specifies the sidecar file format. |
generate | Generate captions from the audio track using automatic speech recognition. Produces a sidecar caption file and, for streaming outputs, a subtitle rendition flagged as auto-generated. | Audio track (no source_stream_index / source_url) | output_format optional — webvtt (default) or srt. |
Note: The
extractoperation only acceptssource_stream_indexsince it extracts subtitles already embedded in the input file. Useconvertwithsource_urlfor external subtitle files.
Generating captions (AI)
The generate operation transcribes the video’s audio track into a caption file. It is the one operation that needs no subtitle source — the captions come from the spoken dialogue itself. Add it to any output that has audio:
{
"operation": "generate"
}That is the whole minimal configuration. Everything else is optional:
language— omit it (or set"auto") to auto-detect the spoken language. Pass an explicit ISO 639-2 code (e.g."eng","deu") to force transcription in that language.autois valid only forgenerate; the other operations reject it.output_format—webvtt(default) orsrt. Rich formats (ttml,ass) are not offered for generated captions.label,is_default— carried through to the manifest like any other track.
{
"operation": "generate",
"language": "auto",
"output_format": "webvtt",
"is_default": true
}A few rules keep the behavior predictable:
- One generate track per job. The audio is transcribed once, so a second
generatetrack is rejected at job creation. - Never burned in.
burn_in_styleis invalid on ageneratetrack. Generate the caption sidecar, then add a separateburn_intrack if you also want hard-subs. - Composes with everything else. A
generatetrack sits alongsideconvert/passthroughtracks of other languages, and works with HLS, DASH, and dual-format packaging.
Honesty markers
Generated captions are always labelled as machine-produced — Transcodely makes no accuracy guarantee:
- The SubtitleResult carries
auto_generated: true. - In HLS manifests the track is tagged
CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog"(the DASH equivalent is best-effort and may be HLS-only initially).
Pricing
AI captions are free on videos hosted with Transcodely (any job whose video_id is set; the captions row is still written, at €0) and an additive fee of €0.01 per minute of source video at list price on transcode-only jobs that deliver to your own origin — metered on the input duration, charged once per job regardless of how many renditions you produce. It is added on top of the encode cost and the processing fee as a fees line item on the job (see Job.fees), and is additive to the processing fee: the two are separate services and neither absorbs the other. The fee is only confirmed if a caption artifact is actually produced — no artifact, no charge.
Translations are a separate fee, captions_translation: €0.02 per source minute per language at list price, with a minimum of €0.05 per video per language, confirmed only for the languages whose caption file was delivered. Their transcript renditions and translated insights are included.
The SubtitleResult object
For every caption artifact it produces, the worker reports a SubtitleResult on the completed job’s subtitle_results array (mirroring thumbnail_results). These are read-only on job responses.
| Attribute | Type | Description |
|---|---|---|
output_id | string | ID (out_...) of the output the track was configured on. |
operation | enum | The operation that produced the artifact. One of generate, extract, convert. |
format | enum | Caption file format: webvtt, srt, ttml, or ass. |
language | string | Detected (for generate with auto-detect) or configured ISO 639-2 language code. |
label | string | Human-readable label. |
auto_generated | boolean | true when produced by generate (automatic speech recognition). |
storage_key | string | Caption file key in the output destination. |
url | string | Fully-qualified URL to the caption file (same resolution rules as ThumbnailResult.url). |
signed_url | string | null | Ready-to-fetch HTTPS URL for the caption file, signed and time-limited. Managed-storage destinations only, on Get and Watch but never List, and it expires. See Signed asset URLs. |
transcript_storage_key | string | generate only: key of the json transcript rendition. The same file is listed in transcript_renditions. |
transcript_url | string | generate only: URL of the json transcript rendition. |
transcript_signed_url | string | null | generate only: signed, time-limited HTTPS URL for the json transcript rendition. Same rules and lifetime as signed_url. |
transcript_renditions | array of objects | generate only: every transcript rendition the track produced, one per format (json, txt, md). See The TranscriptRendition object. Empty for jobs that completed before renditions existed. |
transcript_style | enum | Style the txt and md renditions were written in. One of: clean, literal. Unset when the track produced no renditions. |
translated_from | string | ISO 639-2 language of the recognized track this one was translated from. Set only on tracks produced by translation; empty otherwise. |
Retro-captioning a hosted video
You do not have to re-encode a video to caption it. Point a captions-only job at an already-hosted video with input_video_id and a single generate track — no video variants, no output origin (the managed storage is inferred):
{
"input_video_id": "vid_a1b2c3d4e5f6g7",
"outputs": [
{
"subtitle_tracks": [
{ "operation": "generate" }
]
}
]
}The caption artifact is stored under the video’s managed storage and surfaced on the job’s subtitle_results. In the dashboard this is the Generate captions button on the video detail page. Retro-captioning needs the video’s original single-file source: if it was removed by a lifecycle rule, the generate request fails rather than transcribing a streaming rendition — this limitation is tracked publicly as a known gap on the conformance page.
Regenerating a language the video already has. The new track replaces the video’s existing auto-generated track of the same language. When that track was listed in the video’s HLS manifest (captioned inline at upload with auto_captions), the job also rewrites the manifest’s caption rendition with the new text and the replaced track keeps in_manifest: true, so players still see one entry per language, carrying the current captions. Only machine-generated renditions are rewritten: a rendition packaged from captions you supplied is never overwritten by a transcript. HLS only; a DASH-only package keeps the new track as a sidecar. The CDN cache for the package is purged on completion, so the old text can be served until the edge TTL expires if the purge fails.
Fixing a generated caption
Because captions are machine-produced, you may want to correct them. There is no special edit endpoint — use the tools that already exist:
- Download the caption file from
SubtitleResult.url. - Edit it in any subtitle editor.
- Re-attach it as a
convert(orpassthrough) track fromsource_urlon your next job, replacing the generated one.
Translating generated captions
A generate track can also translate its captions into up to ten other languages with translations. A hosted video that is already captioned can be translated later with TranslateCaptions, which reads the existing transcript and transcribes nothing.
{
"operation": "generate",
"language": "bul",
"translations": ["eng", "ger"]
}Each target language produces, next to the source track:
- a caption file in the same format, reported as one more
SubtitleResultwithauto_generated: true, its ownlanguageandtranslated_fromset to the source; - the
json,txtandmdtranscript renditions; - on streaming outputs, a caption rendition in the manifest, named by the language’s own name.
Every cue keeps the source cue’s exact timing, and the cue count never changes. Translation fails per language: a language whose translation does not line up cue for cue with the source is not delivered and not billed, and the other languages are unaffected.
With insights enabled, the insights are translated too and appear as one more entry per language on Job.insights / Video.insights, with translated_from set. Highlights are not translated.
Codes are normalized to their ISO 639-2/B (bibliographic) form on the response: deu comes back as ger, fra as fre. Supported languages:
| Code | Also accepted | Language |
|---|---|---|
ara | Arabic (العربية) | |
ben | Bengali (বাংলা) | |
bul | Bulgarian (Български) | |
cat | Catalan (Català) | |
chi | zho | Chinese (中文) |
hrv | Croatian (Hrvatski) | |
cze | ces | Czech (Čeština) |
dan | Danish (Dansk) | |
dut | nld | Dutch (Nederlands) |
eng | English (English) | |
est | Estonian (Eesti) | |
fin | Finnish (Suomi) | |
fre | fra | French (Français) |
ger | deu | German (Deutsch) |
gre | ell | Greek (Ελληνικά) |
heb | Hebrew (עברית) | |
hin | Hindi (हिन्दी) | |
hun | Hungarian (Magyar) | |
ind | Indonesian (Indonesia) | |
ita | Italian (Italiano) | |
jpn | Japanese (日本語) | |
kor | Korean (한국어) | |
lav | Latvian (Latviešu) | |
lit | Lithuanian (Lietuvių) | |
may | msa | Malay (Melayu) |
nor | Norwegian (Norsk) | |
per | fas | Persian (فارسی) |
pol | Polish (Polski) | |
por | Portuguese (Português) | |
rum | ron | Romanian (Română) |
rus | Russian (Русский) | |
srp | Serbian (Српски) | |
slo | slk | Slovak (Slovenčina) |
slv | Slovenian (Slovenščina) | |
spa | Spanish (Español) | |
swe | Swedish (Svenska) | |
tam | Tamil (தமிழ்) | |
tha | Thai (ไทย) | |
tur | Turkish (Türkçe) | |
ukr | Ukrainian (Українська) | |
urd | Urdu (اردو) | |
vie | Vietnamese (Tiếng Việt) |
Deployments without translation refuse translations with parameter_unsupported.
Caption style
How AI captions are cut into cues: how much text one cue holds and how long it stays on screen. Cues follow the speech, so a short pause between words does not end a cue, and no cue exceeds the limits. Limits are maximums, not targets: a short sentence is a short cue. Not to be confused with burn-in styling, which is how burned-in text looks.
| Preset | max_chars_per_line | max_lines | max_cue_duration_ms | For |
|---|---|---|---|---|
compact | 42 | 1 | 4000 | Small screens and fast reading |
standard (default) | 42 | 2 | 7000 | About a sentence to a sentence and a half per cue |
long | 50 | 2 | 8000 | Lectures and talks |
Start from a preset, override any limit, or both: max_chars_per_line 20 to 60, max_lines 1 to 3, max_cue_duration_ms 2000 to 10000. Out of range is refused with parameter_out_of_range.
{
"operation": "generate",
"cue_style": { "preset": "long", "max_lines": 3 }
}Every limit not set comes from the preset. With no preset, it comes from the app’s default cue_style (set with UpdateApp), then from standard. Naming a preset on a request replaces the app default as the starting point, so {"preset": "compact"} is always compact. Without a preset, the limits that are set override the app default one by one. The job shows the style actually used, resolved: the preset it started from and all three limits.
To cut captions that already exist into another style, without transcribing again, use RestyleCaptions. It is free, and it keeps the existing style: a language can carry its AI captions in several styles, one track per style, and viewers switch between them in the player’s captions menu. One style is the language’s default, labelled with the language name alone (Bulgarian); the others carry their style after it (Bulgarian (compact)). SetDefaultCaptionStyle changes the default and DeleteCaptionStyle removes a style that is not the default.
Generating captions again for a language replaces the style they are cut in (the default, unless the request names another style the language has). The language’s other styles are kept but marked stale, since they were cut from the previous transcript: restyle them again to bring them up to date.
Formats
Transcodely supports four subtitle formats for input and output.
| Format | API Value | Extension | Description |
|---|---|---|---|
| SRT | srt | .srt | SubRip Text. The most common subtitle format. Plain text with timestamps. Widely supported by all players. |
| WebVTT | webvtt | .vtt | Web Video Text Tracks. Standard for HTML5 <video> and HLS/DASH streaming. Supports styling and positioning. |
| TTML | ttml | .ttml | Timed Text Markup Language. XML-based format used in broadcast, DASH, and IMSC1 (Netflix, Disney+). |
| ASS | ass | .ass | Advanced SubStation Alpha. Rich formatting with fonts, colors, and animations. Common in anime and fansubs. |
Format compatibility
Not all format conversions are lossless. Converting from a rich format to a simpler one may discard styling information:
| From | To | Notes |
|---|---|---|
srt | webvtt | Lossless. SRT is a subset of WebVTT. |
webvtt | srt | Positioning and styling cues are stripped. |
ass | srt / webvtt | Rich formatting (fonts, colors, animations) is stripped. |
ttml | srt / webvtt | XML styling and layout is stripped. |
srt / webvtt | ttml | Text content is preserved; no styling added. |
Container compatibility
For passthrough and convert operations, the subtitle format muxed into the output must be compatible with the output container. For passthrough the relevant format is input_format; for convert it is output_format. Submitting an incompatible combination is rejected at job creation with a parameter_incompatible error.
| Container | Allowed subtitle formats |
|---|---|
hls | webvtt |
dash | webvtt, ttml |
adaptive | webvtt |
mp4 | srt, ttml |
mov | srt, ttml |
webm | srt, webvtt |
mkv | srt, ass |
This check does not apply to burn_in (subtitles are rendered into the video stream) or extract (subtitles are written to a standalone sidecar file), and is skipped when the relevant format field is left unset.
Source options
Every subtitle track requires a source — either an embedded stream from the input file or an external subtitle file. The two modes are mutually exclusive.
Embedded stream
Use source_stream_index to reference a subtitle stream embedded in the input file by its zero-based index. Transcodely does not currently surface embedded subtitle streams through the API, so determine the stream index out-of-band (for example, by running ffprobe on the source file) before submitting the job.
{
"operation": "passthrough",
"source_stream_index": 0,
"language": "eng",
"label": "English"
}External file
Use source_url to reference a standalone subtitle file by URL. Supported schemes: gs://, s3://, and https://. The subtitle file is downloaded and processed alongside the video.
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/spanish.srt",
"input_format": "srt",
"output_format": "webvtt",
"language": "spa",
"label": "Spanish"
}The URL is not fetched when you create the job; only its shape is checked. The worker downloads it when the output is rendered (three attempts with backoff on transport errors, 5xx and 429; any other status is final), so an unreachable or private URL is first discovered there. The downloaded body must also be a subtitle file: an HTML error page served with 200, or an empty body, counts as a failed fetch. What happens next depends on the operation:
burn_in: the output fails with error codesubtitle_fetch_failed. The job’s other outputs still render and bill; the failed output is not billed. The message:The subtitle file for this output could not be fetched from its URL, or is not a valid subtitle file. Check that the URL is public and points to an SRT, WebVTT, ASS or TTML file, then retry.
convertandpassthrough(sidecar tracks): the track is skipped and the output completes without it. Check the output’s subtitle results when a track you asked for is missing.
subtitle_fetch_failed is distinct from download_failed, which means the job’s input could not be fetched. On subtitle_fetch_failed, check the subtitle URL rather than the source.
Burn-in styling
A burn_in track is never dropped silently. The output either carries the burned-in text or fails before any encode starts, so you are never billed the burn-in multiplier for text that is not in the file: subtitle_fetch_failed when the subtitle file could not be fetched (see External file), and output_mismatch when the overlay could not be applied for a reason on our side (no charge; retry or contact support). A burn-in output always encodes in a single pass, so it does not use chunked encoding.
The burn_in_style object controls the appearance of burned-in subtitles. All fields are optional with sensible defaults.
| Attribute | Type | Default | Description |
|---|---|---|---|
font_family | string | "Arial" | Font family name. Max 64 characters. |
font_size | integer | 24 | Font size in pixels (8—120). |
font_color | string | "#FFFFFF" | Text color as hex (e.g., "#FFFFFF" for white). |
outline_color | string | "#000000" | Outline color as hex (e.g., "#000000" for black). |
outline_width | integer | 2 | Outline thickness in pixels (0—10). Set to 0 for no outline. |
margin_bottom | integer | 30 | Bottom margin in pixels (0—200). Distance from the bottom of the video frame. |
{
"burn_in_style": {
"font_family": "Helvetica",
"font_size": 28,
"font_color": "#FFFF00",
"outline_color": "#000000",
"outline_width": 3,
"margin_bottom": 40
}
}Tip: For maximum readability across different video content, use a white font with a black outline (
outline_widthof 2—3). Increasefont_sizefor 4K outputs where the default 24px may appear small.
Transcripts and insights
Every generate track writes its transcript next to the caption file in three renditions, and can opt in to AI insights over that transcript. The Transcripts & Insights guide covers the formats, the styles and the insights sections in depth. This section lists the objects on the wire.
{
"operation": "generate",
"transcript": { "style": "clean" },
"insights": {
"enabled": true,
"hint": "Quarterly earnings call for investors",
"glossary": "EBITDA\nAcme Corp (not Acme Core)"
}
}The TranscriptRendition object
One rendition of a generated transcript, on SubtitleResult.transcript_renditions and on a hosted video’s text_tracks[].transcript_renditions.
| Attribute | Type | Description |
|---|---|---|
format | enum | One of: json, txt, md. |
storage_key | string | Key of the file in the output destination (e.g. job_xxx/subtitles/out_yyy_eng.transcript.md). |
url | string | Fully-qualified storage URL of the file. |
signed_url | string | null | Ready-to-fetch HTTPS URL, signed and time-limited. Same rules and lifetime as SubtitleResult.signed_url. |
The TranscriptInsights object
AI insights produced from one generated transcript, on Job.insights and Video.insights. Requested on a captions job with insights.enabled, or on a hosted video’s existing captions with GenerateInsights. Read-only. The sections are present only once status is ready, and are written in the transcript’s language unless the hint asks otherwise. Times are in seconds as JSON numbers.
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier of this entry (ins_). |
source | enum | Where the entry came from: job (a captions job) or video (GenerateInsights). |
output_id | string | The out_ output the generate track was configured on. Empty for source video. |
video_id | string | The hosted video the entry belongs to, for source video. Empty for source job. |
language | string | ISO 639-2 language code of the transcript. |
status | enum | One of: pending, ready, failed. |
error_code | string | Why the insights failed, when status is failed: insights_invalid, insights_unsupported_origin, insights_too_long, insights_transcript_unavailable, insights_refused or insights_unavailable. Empty otherwise. |
title_suggestions | array of strings | One to three suggested titles. |
summary | string | A summary of the content, at most four sentences. |
key_points | array of strings | Three to seven key points. |
chapters | array of objects | Chapters ordered by start time, covering the whole video. Each has start_seconds, end_seconds and title. Also delivered as chapters.vtt. |
questions | array of objects | Up to six questions the content answers, each with question, answer (at most two sentences) and start_seconds. |
terms | array of objects | Up to ten key terms, each with term, definition and start_seconds. |
highlights | array of objects | Verbatim quotes from the transcript, each with text, start_seconds and end_seconds (the bounds of the quote’s paragraph). |
topics | array of strings | Up to ten short topic labels. |
storage_key | string | Storage key of insights.json. |
url | string | Fully-qualified storage URL of insights.json. |
signed_url | string | null | Signed, time-limited HTTPS URL for insights.json. |
chapters_storage_key | string | Storage key of chapters.vtt. |
chapters_url | string | Fully-qualified storage URL of chapters.vtt. |
chapters_signed_url | string | null | Signed, time-limited HTTPS URL for chapters.vtt. |
markdown_storage_key | string | Storage key of insights.md. |
markdown_url | string | Fully-qualified storage URL of insights.md. |
markdown_signed_url | string | null | Signed, time-limited HTTPS URL for insights.md. |
generated_at | timestamp | null | When the insights became ready. Absent until then. |
hint | string | The hint the insights were requested with. Empty when none. |
glossary | string | The glossary the insights were requested with. Empty when none. |
translated_from | string | ISO 639-2 language of the insights this entry was translated from. Empty when the insights were written in the transcript’s own language. A translated entry keeps every timing of its source entry; highlights stay in the source language. |
fee_eur | number | null | Price of the entry in EUR, for source video: €0.05 per video plus €0.005 per minute of source at list price, fixed when the entry was created and charged only when status becomes ready. An entry that becomes ready after a newer entry in the same language was already shown on the video is not charged, and shows 0. Absent for source job, whose insights fees are on Job.fees. |
{
"output_id": "out_a1b2c3d4e5f6g7",
"language": "eng",
"status": "pending",
"hint": "Quarterly earnings call for investors",
"glossary": "EBITDA\nAcme Corp (not Acme Core)"
}Insights run after the job completes. Watch Job.insights or subscribe to the job.insights.ready and job.insights.failed webhooks. Insights generated from a video’s existing captions fire video.insights.ready and video.insights.failed instead. Deployments without the feature reject insights.enabled with parameter_unsupported.
The transcript text (never the audio or video) is sent to Anthropic, our AI subprocessor, to produce the insights. It is not used to train models. See Subprocessors.
The ChapterResult object
Superseded and never populated. Chapters are produced by insights: read them from TranscriptInsights.chapters, or fetch chapters.vtt from chapters_url. The job’s chapter_results array stays on the wire, always empty, so existing generated code keeps compiling.
A chapters.vtt file looks like this:
WEBVTT
00:00:00.000 --> 00:00:42.500
Introduction
00:00:42.500 --> 00:02:08.000
Getting Started
00:02:08.000 --> 00:05:05.200
Advanced UsageExamples
Passthrough embedded subtitle
Pass through an embedded subtitle track from the input file into an HLS output without modification.
{
"type": "hls",
"video": [
{"codec": "h264", "resolution": "1080p", "quality": "standard"}
],
"subtitle_tracks": [
{
"operation": "passthrough",
"source_stream_index": 0,
"language": "eng",
"label": "English",
"is_default": true
}
]
}Convert SRT to WebVTT
Convert an external SRT file to WebVTT format for HLS streaming compatibility.
{
"type": "hls",
"video": [
{"codec": "h264", "resolution": "1080p", "quality": "standard"}
],
"subtitle_tracks": [
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/english.srt",
"input_format": "srt",
"output_format": "webvtt",
"language": "eng",
"label": "English",
"is_default": true
}
]
}Burn-in with custom styling
Burn subtitles directly into the video frames with custom font, color, and positioning. The resulting video will have permanently visible subtitles.
{
"type": "mp4",
"video": [
{"codec": "h264", "resolution": "1080p", "quality": "standard"}
],
"subtitle_tracks": [
{
"operation": "burn_in",
"source_url": "https://cdn.example.com/subs/spanish.srt",
"language": "spa",
"burn_in_style": {
"font_family": "Helvetica",
"font_size": 28,
"font_color": "#FFFF00",
"outline_color": "#000000",
"outline_width": 3,
"margin_bottom": 40
}
}
]
}Multi-language streaming with SDH
An adaptive output carrying four subtitle tracks: English (default) and Spanish converted from SRT to WebVTT, an English SDH track flagged hearing_impaired, and a forced French track passed through from an embedded stream.
{
"type": "adaptive",
"video": [
{"codec": "h264", "resolution": "1080p", "quality": "standard"},
{"codec": "h264", "resolution": "720p", "quality": "standard"}
],
"subtitle_tracks": [
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/en.srt",
"output_format": "webvtt",
"language": "eng",
"label": "English",
"is_default": true
},
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/en-sdh.srt",
"output_format": "webvtt",
"language": "eng",
"label": "English (SDH)",
"hearing_impaired": true
},
{
"operation": "convert",
"source_url": "gs://my-bucket/subs/es.srt",
"output_format": "webvtt",
"language": "spa",
"label": "Spanish"
},
{
"operation": "passthrough",
"source_stream_index": 2,
"language": "fra",
"label": "French (Forced)",
"forced": true
}
]
}Validation rules
Transcodely validates subtitle track configuration at job creation time. The following constraints are enforced:
| Rule | Description |
|---|---|
| Maximum 8 tracks | Each output supports up to 8 subtitle_tracks entries. |
| Mutually exclusive source | source_stream_index and source_url cannot both be set on the same track. The passthrough and extract operations additionally require that exactly one is set. |
extract requires stream index | The extract operation only accepts source_stream_index, not source_url. |
convert requires output format | The convert operation requires output_format to be set. |
| Container compatibility | For passthrough and convert, the subtitle format must be compatible with the output container. See Container compatibility. |
burn_in_style requires burn-in | The burn_in_style object is only valid when operation is burn_in. Generated captions are never burned in. |
Single generate track | At most one generate track per job — the audio is transcribed once. |
generate takes no source | A generate track must not set source_stream_index or source_url; captions come from the audio. |
generate output format | For generate, output_format (if set) must be webvtt or srt. |
| Language format | language must be a valid ISO 639-2 three-letter code matching ^[a-z]{3}$, or auto for the generate operation. |
translations only on generate | translations is refused with parameter_forbidden on any other operation. |
| Translation languages | At most 10, distinct after normalization (deu and ger are the same language), none equal to the track’s language, each one of the supported languages. Otherwise parameter_invalid on the offending element, listing the supported codes. |
| Stream index range | source_stream_index must be between 0 and 31 (inclusive). |
| URL schemes | source_url must use gs://, s3://, or https:// scheme. Max 2048 characters. |
| Label length | label must not exceed 64 characters. |