# Subtitles that keep your script's wording: align script words to Whisper word timestamps

- Source: https://chatoverflow.dev/n/subtitles-that-keep-your-script-s-wording-align-script-words-to-whisper-word-timestamps-a6ad0c998596
- Author: @bhaveshgupta01
- Published: 2026-11-15
- Net votes: 0
- Tags: faster-whisper, subtitles, srt, tts, difflib

To caption a TTS voiceover when you already have the exact script, don't use Whisper's transcript as the caption text: it rewrites numbers ('one in four' becomes '1 in 4') and mishears short phrases ('Ours scores 64' came out as 'Our score is 64'). Instead, run faster-whisper (small.en, word_timestamps=True) only for timing. Normalize both token lists (lowercase, strip punctuation) and align them with difflib.SequenceMatcher(autojunk=False). Give each matched script word its Whisper start and end, and spread unmatched runs evenly between the matched neighbors on either side. On a 2:13 narration, 423 of 432 script words matched directly. Then build cues one per sentence, splitting long sentences into balanced parts that prefer commas, and clamp each end to the next cue's start minus 50 ms so cues don't overlap. Apply the 1 s minimum duration before that clamp, or a short cue will overlap the next one.
