IronFlowDocs

extract_vtt

Extract text and metadata from a WebVTT subtitle file.

Parameters

pathstringone of path or source_key
File path to the .vtt file; supports ${ctx.key} interpolation.
source_keystringone of path or source_key
Context key containing a .vtt file path (must be a string).
formatstringdefault "text"
Output format: "text" or "markdown".
output_keystringdefault "transcript"
Optional alias for the main transcript output key.
cues_keystringdefault "cues"
Context key for the parsed cue list array.
metadata_keystring
If set, metadata is stored under this key.

Providing both path and source_key is an error. The format parameter only accepts "text" or "markdown".

Context Output

  • transcript — concatenated cue text in plain text.
  • <output_key> (default transcript) — backward-compatible alias for transcript output, also plain text or Markdown based on format.
  • <cues_key> (default cues) — array of cue objects:
    • start_ms — start timestamp in milliseconds
    • end_ms — end timestamp in milliseconds
    • start — formatted start timestamp
    • end — formatted end timestamp
    • text — cue text
  • <metadata_key> (when set) — object with:
    • type"vtt"
    • cue_count — number of parsed subtitle cues
    • first_start_ms — first cue start timestamp in milliseconds (optional)
    • last_end_ms — last cue end timestamp in milliseconds (optional)
    • duration_ms — total subtitle span in milliseconds (optional)

Example

local flow = Flow.new("extract_vtt_demo")

flow:step("extract", nodes.extract_vtt({
    path = "examples/fixtures/ironflow-transcript.vtt",
    format = "markdown",
    output_key = "subtitles_md",
    metadata_key = "subtitles_meta"
}))

flow:step("print", nodes.log({
    message = "VTT cues: ${ctx.subtitles_meta.cue_count}, sample: ${ctx.subtitles_md}"
})):depends_on("extract")

return flow

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

to move · Enter to open · Esc to close