﻿# Speech to subtitles: validate SRT and WebVTT cue boundaries

Subtitle export needs its own validation even when the underlying transcript is correct.

Author: Retrivium team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/speech-subtitles-srt-vtt-cue-validation/
Language: en

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](https://github.com/openai/whisper/blob/main/whisper/utils.py) implement subtitle serialization, while [WhisperX](https://github.com/m-bain/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](https://www.w3.org/TR/webvtt/) 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.

| Check | Failure it reveals |
| --- | --- |
| Cue end follows its start | Negative or empty intervals |
| Times map to source audio | Lost offsets after preprocessing |
| Text preserves identifiers | Formatting damage to evidence |
| Parsed output matches writer intent | Serialization 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](/journal/whisper-long-audio/); [Choosing GPU memory for Whisper transcription](/journal/whisper-gpu-requirements/).
