# How to sync captions word by word with Whisper

> For captions to follow speech word by word, the text should come from the script and only the timing of each word from Whisper. The Konecz engine runs Whisper large-v3-turbo on the graphics card, aligns the words it heard with the script's words and records the start and end of each one in seconds.

Pedro Henrique Lahr, Konecz, 2026-11-24. https://konecz.com/en/blog/legenda-palavra-por-palavra-whisper

Captions that light up word by word with the voice depend on knowing when each word starts and ends. The approach Konecz uses: the text comes from the script, the timing comes from Whisper. The engine runs the Whisper large-v3-turbo model on the graphics card, compares the words it heard with the script's words and records, for each script word, the exact second it starts and ends.

## Why not use the text Whisper transcribes?

Because Whisper gets spelling wrong even when it gets timing right. It writes «two thousand» where the script says «2,000», drops accents and punctuation and sometimes hears a similar word. In a caption, that shows up as a typo.

The script, on the other hand, has already been reviewed and approved. It has the right accents, punctuation and numbers. So the split is simple: the script owns the text, Whisper owns the clock.

## How does it work, step by step?

The `kodecz prepare words` command takes the voice audio and the script as text and does this:

1. **Cuts the trailing silence.** The audio becomes mono at 16 kHz and is cut 0.2 seconds after the voice ends. In the silence after speech, Whisper makes words up.
2. **Transcribes with word timings.** faster-whisper runs the large-v3-turbo model on the card (CUDA, float16), with per-word timestamps on. No supporting prompt: a prompt makes the recognizer write that text instead of what was said.
3. **Aligns script and speech.** The two word lists are compared by a simplified key (lowercase, no accents, letters and digits only). Words that match take the heard timing.
4. **Handles what does not match.** Where the script says «2,000» and the voice said «two thousand», the script words share the time of the heard words in that stretch, in proportion to their length. A heard word that is not in the script is dropped.
5. **Writes the speech file.** A list with the text of each script word and its start and end in seconds, to three decimals.

Times never go backwards and never pass the cut.

## How do you know the alignment worked?

The command returns a similarity score between the script and what was heard: 2 × matched words ÷ (script words + heard words). Below 0.8, it warns. Each differing stretch is printed too, like this:

`script «2.000» ← heard «dois mil»`

That catches, right away, a voice generated from the wrong block or a stretch that was left out.

## What if the voice and the caption should differ?

That is common, and it is a rule in the Konecz way of making video: numbers, acronyms, dates and addresses are spelled out only in the voice, and the caption keeps the normal spelling. In a title like «39 bilhões aprovados numa segunda-feira» (39 billion approved on a Monday), from Vigia Pix, the voice gets «thirty-nine billion» spelled out and the caption shows «39». The swaps live in a table in the script, and the alignment in step 4 handles the timing by itself.

## What is the timing of each word used for?

Three things, all in the engine:

- **Captions.** Each phrase appears and disappears on the timing of its words, always on a single line. Phrases are built by the width of each format (9:16 or 16:9), not by a fixed word count.
- **Animations.** A title, chart or zoom enters and leaves on word timings, never on a fixed second. If the speech changes, everything repositions itself.
- **Checks.** The speech file says where each sentence ends, and the automatic check uses that to verify, for example, that a zoom returns during a pause.

## Frequently asked questions

**Do you need a graphics card to run Whisper?**
In the Konecz engine, yes, by choice: the command fails if there is no CUDA, rather than quietly falling back to the processor. You can run it on the CPU on purpose, with its own option.

**How big is the model?**
faster-whisper's large-v3-turbo is about 1.6 GB and is downloaded once.

**Does it work in English?**
Yes. The language is a parameter of the command; the default is Portuguese.

**Does Whisper get the timing wrong?**
Sometimes, especially on the first word after a pause. That is why the silence cut and the sentence checks exist.

The full engine is on the [Kodecz](/kodecz) page. This is the path Konecz uses to tie captions and motion to the voice; see the results in the [portfolio](/en/portfolio).
