TECHNOLOGY

Speech to subtitles: validate SRT and WebVTT cue boundaries

In this article
THE QUICK TAKE

WebVTT permits overlapping cues, so subtitle validation must distinguish intended overlap from syntax and source-alignment errors.

Subtitle export needs its own validation even when the underlying transcript is correct. SRT and WebVTT cues are presentation intervals, not direct substitutes for word alignment; invalid timing, escaped text or poorly chosen boundaries can make accurate speech evidence unreadable or misleading during playback.

Separate words from cues

The Whisper output writers implement subtitle serialization, while WhisperX supplies alignment-oriented workflows. A cue can contain several words and span pauses chosen for readability. Preserve the original word record and the rule that groups words into cues. Changing subtitle line length should not silently alter the transcript or overwrite original word times used by search and citation.

Validate format-specific syntax

The WebVTT specification defines cue syntax and timing. SRT and WebVTT are related formats but should not be treated as the same file with a different extension. Use a format-aware writer and parser. Check headers, separators and text escaping against the chosen format rather than relying on a player that happens to tolerate malformed output. Acceptance in one player does not establish general interoperability.

Build a boundary-focused fixture

Use a short recording containing a speaker change, a brief pause and a technical identifier. Construct subtitles and play them against the source. The identifier must remain intact and visible long enough to read, while the speaker change should not imply the wrong person said the following words. This is an editorial timing fixture, not a claim that one universal cue duration fits every language or audience.

CheckFailure it reveals
Cue end follows its startNegative or empty intervals
Times map to source audioLost offsets after preprocessing
Text preserves identifiersFormatting damage to evidence
Parsed output matches writer intentSerialization incompatibility

Treat overlap and missing timing explicitly

WebVTT can represent overlapping cues, so overlap is not automatically a syntax error. Decide whether it is intended for the chosen presentation. Words without reliable alignment need a declared approximation or a broader source span, not invented precision. Keep their uncertainty in the internal record even if the final subtitle format cannot display every detail. Test cues around trimmed or concatenated audio especially carefully.

Test the published artifact

Parse the exported file, inspect its timing sequence and review playback at difficult boundaries. Compare the displayed wording with the source transcript. Save the writer version and grouping policy so a layout change can be reproduced. A validated subtitle artifact combines syntactic correctness, readable presentation and faithful source mapping; none of those follows merely from having a successful ASR response or a file ending in the expected subtitle extension.

Related reading: Long audio with Whisper: segments, queues and durable results; Choosing GPU memory for Whisper transcription.

← All articles