Skip to content
Search Documentation
Search across all documentation pages
Subtitles

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

AttributeTypeRequiredDescription
operationenumYesSubtitle operation. One of: passthrough, convert, burn_in, extract, generate. See Operations.
source_stream_indexintegerOne ofIndex 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_urlstringOne ofURL to an external subtitle file. Supported schemes: gs://, s3://, https://. Mutually exclusive with source_stream_index. Max 2048 characters. Not used by generate.
input_formatenumNoInput subtitle format. One of: srt, webvtt, ttml, ass. Auto-detected when omitted.
output_formatenumNoOutput 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).
languagestringNoISO 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.
labelstringNoHuman-readable label (e.g., "English", "Spanish (Latin America)"). Max 64 characters.
is_defaultbooleanNoMark as the default subtitle track for the player.
hearing_impairedbooleanNoFlag for hearing-impaired / closed caption tracks (SDH).
forcedbooleanNoFlag for forced subtitles (e.g., foreign-language dialogue in an otherwise native-language film).
burn_in_styleobjectNoStyling for burn-in subtitles. Only valid when operation is burn_in. See Burn-in styling.
transcriptobjectNoTranscript 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.
insightsobjectNoAI 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.
translationsarray of stringsNoAlso 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_styleobjectNoHow 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_chaptersbooleanNoDeprecated: 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.

OperationDescriptionSourceOutput
passthroughCopy the subtitle track to the output without modification.source_stream_index or source_urlPreserves original format.
convertConvert between subtitle formats.source_stream_index or source_urloutput_format required.
burn_inRender subtitles directly into the video frames. Produces a hard-subbed video — subtitles cannot be turned off by the viewer.source_stream_index or source_urlNo sidecar file produced. burn_in_style optional.
extractExtract an embedded subtitle stream as a standalone sidecar file.source_stream_index onlyoutput_format specifies the sidecar file format.
generateGenerate 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 extract operation only accepts source_stream_index since it extracts subtitles already embedded in the input file. Use convert with source_url for 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. auto is valid only for generate; the other operations reject it.
  • output_format — webvtt (default) or srt. 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 generate track is rejected at job creation.
  • Never burned in. burn_in_style is invalid on a generate track. Generate the caption sidecar, then add a separate burn_in track if you also want hard-subs.
  • Composes with everything else. A generate track sits alongside convert/passthrough tracks 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.

AttributeTypeDescription
output_idstringID (out_...) of the output the track was configured on.
operationenumThe operation that produced the artifact. One of generate, extract, convert.
formatenumCaption file format: webvtt, srt, ttml, or ass.
languagestringDetected (for generate with auto-detect) or configured ISO 639-2 language code.
labelstringHuman-readable label.
auto_generatedbooleantrue when produced by generate (automatic speech recognition).
storage_keystringCaption file key in the output destination.
urlstringFully-qualified URL to the caption file (same resolution rules as ThumbnailResult.url).
signed_urlstring | nullReady-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_keystringgenerate only: key of the json transcript rendition. The same file is listed in transcript_renditions.
transcript_urlstringgenerate only: URL of the json transcript rendition.
transcript_signed_urlstring | nullgenerate only: signed, time-limited HTTPS URL for the json transcript rendition. Same rules and lifetime as signed_url.
transcript_renditionsarray of objectsgenerate 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_styleenumStyle the txt and md renditions were written in. One of: clean, literal. Unset when the track produced no renditions.
translated_fromstringISO 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:

  1. Download the caption file from SubtitleResult.url.
  2. Edit it in any subtitle editor.
  3. Re-attach it as a convert (or passthrough) track from source_url on 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 SubtitleResult with auto_generated: true, its own language and translated_from set to the source;
  • the json, txt and md transcript 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:

CodeAlso acceptedLanguage
araArabic (العربية)
benBengali (বাংলা)
bulBulgarian (Български)
catCatalan (Català)
chizhoChinese (中文)
hrvCroatian (Hrvatski)
czecesCzech (Čeština)
danDanish (Dansk)
dutnldDutch (Nederlands)
engEnglish (English)
estEstonian (Eesti)
finFinnish (Suomi)
frefraFrench (Français)
gerdeuGerman (Deutsch)
greellGreek (Ελληνικά)
hebHebrew (עברית)
hinHindi (हिन्दी)
hunHungarian (Magyar)
indIndonesian (Indonesia)
itaItalian (Italiano)
jpnJapanese (日本語)
korKorean (한국어)
lavLatvian (Latviešu)
litLithuanian (Lietuvių)
maymsaMalay (Melayu)
norNorwegian (Norsk)
perfasPersian (فارسی)
polPolish (Polski)
porPortuguese (Português)
rumronRomanian (Română)
rusRussian (Русский)
srpSerbian (Српски)
sloslkSlovak (Slovenčina)
slvSlovenian (Slovenščina)
spaSpanish (Español)
sweSwedish (Svenska)
tamTamil (தமிழ்)
thaThai (ไทย)
turTurkish (Türkçe)
ukrUkrainian (Українська)
urdUrdu (اردو)
vieVietnamese (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.

Presetmax_chars_per_linemax_linesmax_cue_duration_msFor
compact4214000Small screens and fast reading
standard (default)4227000About a sentence to a sentence and a half per cue
long5028000Lectures 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.

FormatAPI ValueExtensionDescription
SRTsrt.srtSubRip Text. The most common subtitle format. Plain text with timestamps. Widely supported by all players.
WebVTTwebvtt.vttWeb Video Text Tracks. Standard for HTML5 <video> and HLS/DASH streaming. Supports styling and positioning.
TTMLttml.ttmlTimed Text Markup Language. XML-based format used in broadcast, DASH, and IMSC1 (Netflix, Disney+).
ASSass.assAdvanced 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:

FromToNotes
srtwebvttLossless. SRT is a subset of WebVTT.
webvttsrtPositioning and styling cues are stripped.
asssrt / webvttRich formatting (fonts, colors, animations) is stripped.
ttmlsrt / webvttXML styling and layout is stripped.
srt / webvttttmlText 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.

ContainerAllowed subtitle formats
hlswebvtt
dashwebvtt, ttml
adaptivewebvtt
mp4srt, ttml
movsrt, ttml
webmsrt, webvtt
mkvsrt, 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 code subtitle_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.

  • convert and passthrough (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.

AttributeTypeDefaultDescription
font_familystring"Arial"Font family name. Max 64 characters.
font_sizeinteger24Font size in pixels (8—120).
font_colorstring"#FFFFFF"Text color as hex (e.g., "#FFFFFF" for white).
outline_colorstring"#000000"Outline color as hex (e.g., "#000000" for black).
outline_widthinteger2Outline thickness in pixels (0—10). Set to 0 for no outline.
margin_bottominteger30Bottom 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_width of 2—3). Increase font_size for 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.

AttributeTypeDescription
formatenumOne of: json, txt, md.
storage_keystringKey of the file in the output destination (e.g. job_xxx/subtitles/out_yyy_eng.transcript.md).
urlstringFully-qualified storage URL of the file.
signed_urlstring | nullReady-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.

AttributeTypeDescription
idstringUnique identifier of this entry (ins_).
sourceenumWhere the entry came from: job (a captions job) or video (GenerateInsights).
output_idstringThe out_ output the generate track was configured on. Empty for source video.
video_idstringThe hosted video the entry belongs to, for source video. Empty for source job.
languagestringISO 639-2 language code of the transcript.
statusenumOne of: pending, ready, failed.
error_codestringWhy 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_suggestionsarray of stringsOne to three suggested titles.
summarystringA summary of the content, at most four sentences.
key_pointsarray of stringsThree to seven key points.
chaptersarray of objectsChapters ordered by start time, covering the whole video. Each has start_seconds, end_seconds and title. Also delivered as chapters.vtt.
questionsarray of objectsUp to six questions the content answers, each with question, answer (at most two sentences) and start_seconds.
termsarray of objectsUp to ten key terms, each with term, definition and start_seconds.
highlightsarray of objectsVerbatim quotes from the transcript, each with text, start_seconds and end_seconds (the bounds of the quote’s paragraph).
topicsarray of stringsUp to ten short topic labels.
storage_keystringStorage key of insights.json.
urlstringFully-qualified storage URL of insights.json.
signed_urlstring | nullSigned, time-limited HTTPS URL for insights.json.
chapters_storage_keystringStorage key of chapters.vtt.
chapters_urlstringFully-qualified storage URL of chapters.vtt.
chapters_signed_urlstring | nullSigned, time-limited HTTPS URL for chapters.vtt.
markdown_storage_keystringStorage key of insights.md.
markdown_urlstringFully-qualified storage URL of insights.md.
markdown_signed_urlstring | nullSigned, time-limited HTTPS URL for insights.md.
generated_attimestamp | nullWhen the insights became ready. Absent until then.
hintstringThe hint the insights were requested with. Empty when none.
glossarystringThe glossary the insights were requested with. Empty when none.
translated_fromstringISO 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_eurnumber | nullPrice 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 Usage

Examples

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:

RuleDescription
Maximum 8 tracksEach output supports up to 8 subtitle_tracks entries.
Mutually exclusive sourcesource_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 indexThe extract operation only accepts source_stream_index, not source_url.
convert requires output formatThe convert operation requires output_format to be set.
Container compatibilityFor passthrough and convert, the subtitle format must be compatible with the output container. See Container compatibility.
burn_in_style requires burn-inThe burn_in_style object is only valid when operation is burn_in. Generated captions are never burned in.
Single generate trackAt most one generate track per job — the audio is transcribed once.
generate takes no sourceA generate track must not set source_stream_index or source_url; captions come from the audio.
generate output formatFor generate, output_format (if set) must be webvtt or srt.
Language formatlanguage must be a valid ISO 639-2 three-letter code matching ^[a-z]{3}$, or auto for the generate operation.
translations only on generatetranslations is refused with parameter_forbidden on any other operation.
Translation languagesAt 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 rangesource_stream_index must be between 0 and 31 (inclusive).
URL schemessource_url must use gs://, s3://, or https:// scheme. Max 2048 characters.
Label lengthlabel must not exceed 64 characters.

Run this against your own file

A free account runs standard-quality encodes up to 2 minutes, one at a time (a longer upload is shortened to its first 2 minutes), so the Quickstart runs with nothing set up but an API key.