Automatic dubs lose sync around the three-minute mark. The cause is not translation or audio quality. It is a single line of arithmetic in the assembly loop. This article traces where the drift comes from, explains three obvious fixes that do not work, and shows why anchoring each segment to the source timeline instead of accumulating a cursor changes the entire architecture — with real code.
Every automatic dubbing tool I tried failed in exactly the same way, and always at roughly the same point.
The first thirty seconds are flawless. The translated voice sits over the speaker, the rhythm feels natural, and you start to think the problem has finally been solved. Two minutes in, something begins to slip. The audio ends a moment after the speaker's mouth has stopped moving. By the third minute, the dub is an entire sentence behind, and the illusion is gone for good. Nobody watches a video to the end when the audio is arguing with the picture.
This is not a quality problem. The transcription can be perfect, the translation can be excellent, and every sentence can sound great on its own. The dub will still drift. The failure is structural. It is hidden in a single line of arithmetic, and once you see it, you cannot unsee it.
The Line That Causes the Problem
The naive way to assemble a dub is also the most obvious. You have subtitle segments with start times. You synthesize each sentence, then place them one after another:
cursor = 0 for segment in segments: audio = synthesize(segment.text) timeline.place(audio, at=cursor) cursor += audio.duration # ← here cursor += audio.duration. That's it. That's the bug.
Synthesized speech is never exactly the same length as the source sentence it replaces. A German translation may be longer than the English original; a more concise translation may be shorter. The TTS engine adds its own variation, too. Each line can be off by a few hundred milliseconds — so little that you barely notice it.
But += accumulates those errors. Take two hundred segments, each averaging 300 ms of extra length. By the end, the dub is sixty seconds out of sync. The error at any point is the sum of every error that came before it. In other words, the dub does not gradually get worse. It moves steadily farther away from the source, and the longer the video, the worse the result.
This is why dubbing demos are always short.
Three Fixes That Do Not Work
Once you notice the drift, three fixes seem obvious. I tried all three.
Slow the audio down so it fits. Stretch the audio itself when a clip runs long instead of giving it a wider time window. This fails immediately: slowed speech sounds sluggish. Vowels stretch, consonants soften, and the listener can tell something is wrong long before they can explain why. Speeding speech up is tolerable — we hear people talk quickly every day. Nobody talks in slow motion.
Cut the silence. Trim pauses to win back milliseconds. But pauses are not empty space. The speaker breathes there; the sentence finds its shape there. Remove them and the dub turns into an auctioneer. You have traded a synchronization problem for a delivery problem.
Retiming the video. Stretch the picture to match the audio. This works, and it is exactly what a video editor would do. But now you are re-encoding the video to accommodate a text-to-speech engine. That is an enormous tail wagging a very large dog.
All three approaches share the same mistaken assumption: that drift is an audio problem that needs to be absorbed somewhere. It is not. It is an accounting problem.
Anchor the Timeline. Do Not Accumulate a Cursor.
The source video already knows when every sentence is supposed to begin. That information is in the transcript, and it is precise. The naive loop simply throws it away. It takes the next position from the timeline it is building rather than from the source timeline it is dubbing.
So do not do that. Give each sentence a slot that runs from its own source start time to the next sentence's source start time, then fit the audio into that slot:
def _plan_anchored_block(actual_ms, start_ms, next_start_ms): """Returns (trim_ms, pad_ms) for the slot [start_ms, next_start_ms].""" room = next_start_ms - start_ms if room > 0 and actual_ms > room: return (actual_ms - room), 0.0 # over-runs: trim it return 0.0, max(0.0, room - actual_ms) # short: pad the remainder A clip that overruns its slot is trimmed, with a short fade so it does not click. A clip that is too short has the remaining time filled with silence. Then comes the important part: the cursor for the next sentence is not calculated at all.
return float(next_start_ms) It is anchored to the source timeline. Every sentence starts where the original speaker started, regardless of what happened to the sentence before it. An error in one segment stays in that segment. It is not reduced or compensated for. It simply has nowhere to accumulate.
That is the whole idea. Four lines of arithmetic are the difference between a dub that falls apart in the third minute and one that does not.
What This Decision Costs You
Here is the part I did not expect: choosing anchored placement does not just fix timing. It dictates the rest of the architecture, because every sentence now has a hard deadline.
The translator needs a length budget. If a translation is twice as long as its slot, anchoring means cutting it off — and losing words. So the length constraint has to move upstream, into the translation stage. Each line gets a character budget derived from its duration and speaking rate, and the model is encouraged to be concise rather than literal when both cannot be achieved. Fixing timing ultimately becomes a prompt-engineering problem.
Speech can speed up, but it should not slow down. Because short clips are padded rather than stretched, the time-stretcher has only one job left:
if not allow_slowdown: if ratio < 1.0: return 1.0 # shorter than the slot: keep natural pace return min(ratio, STRETCH_MAX_SPEEDUP) A short clip keeps its natural pace, and the remaining time becomes silence — which is what a pause should sound like anyway. Only clips that overrun their slots are compressed, and even then only up to a limit. Beyond that point, fast speech becomes a problem of its own.
Expressiveness needs boundaries. This one catches you later. Allow an operator to request a "slow, dramatic delivery" and pass that instruction straight to a TTS engine that follows it, and you get longer audio. The placement layer then trims it. Style quietly destroys the synchronization it is supposed to sit on top of. The solution is to treat pace as non-negotiable: whatever style the user requests, the timing instruction is appended last, because models tend to give the final instruction the most weight.
Emotion changes how a sentence sounds, never how long it lasts.
One decision about a cursor propagates into translation, synthesis, and the amount of creative control you can safely give the user. That is what makes it an architectural decision rather than a bug fix.
How to Know It Works
Claiming that a dub "stays in sync" is easy and impossible to verify, so it is worth explaining how to test it. Listening took me only so far. Two things helped much more.
The first is a golden regression harness. You record the deterministic half of the pipeline — sentence assembly, length budgets, SRT timestamps, and placement arithmetic — against known inputs, then diff every subsequent run against it. There is no model, no network, and no API key involved, so it runs in seconds in CI. The timing arithmetic is deliberately kept pure so it can be locked down this way.
The second is a round-trip quality gate. You transcribe every synthesized clip back through a second ASR model and compare the result with the text that was supposed to be spoken. The resulting word error rate (WER) is a blunt instrument, but it catches things that listening does not. In my case, it showed that a widely used cloud TTS engine mangled some low-resource languages so badly that a smaller local voice clearly outperformed it.
There was another lesson in that measurement. I published per-language WER figures, then reran the same engine on different source material and got results that were twice as bad. Both runs were correct. The problem was that I had asked the number to carry more weight than it could support. A WER figure without the source clip beside it is not a claim you can defend. It is an uncomfortable thing to learn about your own benchmark, and a good reason to share the measurement script rather than the score itself.
The Code
All of this lives in Voxa: an MIT-licensed, single-file Python dubbing engine. It transcribes, translates with context and length budgets, generates speech using one of four engines, and mixes the result over the original:
pipx install voxa-dub voxa talk.mp4 --target_lang ru The default settings do not require an API key. The placement code is about forty lines, and the arithmetic above is not a simplified version for the article. It is the actual implementation.
Here is what the cursor decision changes. The same three-minute clip is dubbed once and placed in two different ways, with the counter tracking real segment timings: naive assembly ends up eighteen seconds behind the speaker, while anchored placement stays at zero from the first sentence to the last.
If you are building something in this space, inspect what the cursor does inside your assembly loop. If it accumulates, you have this bug — and you will find it around the third minute of your first long video.
Frequently Asked Questions
Is this problem specific to AI dubbing?
No. Any pipeline that concatenates synthesized audio chunks sequentially carries the same risk, including simple text-to-speech readers and scripts you write yourself. Professional dubbing studios do not run into this problem because an editor places every line against the picture. The issue is not model quality. It is how the cursor is calculated.
Does anchored placement cause words to be lost?
It can, if a translation runs longer than its slot: the end of the clip gets trimmed. That is exactly why the length constraint is moved into the translation stage. Each line receives a character budget derived from its duration, and the model is guided toward concise rather than literal translations. Trimming is the last resort, not the first line of defence.
Can you fix drift later in the finished dub file?
Not practically. Because the error accumulates, reversing it requires the source timestamps for every segment. If you already have those timestamps, anchoring the placement from the start is cheaper. The fix belongs in the assembly loop, not in post-processing.
