Every code-explainer video has the same invisible bug. A line of code lights up
a quarter second after the narrator says it. Nobody notices in the editor.
Everybody notices on a phone.

I made seven of these films before I admitted the problem wasn't my eye. It was
that I was placing captions by hand, frame by frame, in a timeline that shifts
every time I re-record a line.

So I deleted the hand-placed cues and made the audio tell the video where the
sentences are.

The idea: measure, don't animate

Narration is the one thing that cannot be faked. If a sentence starts at 4.31s,
that is a fact. Everything else — which card is on screen, which line of code is
lit — is style. So the style should read the fact, not compete with it.

The measurement step is unglamorous: decode the wav, find the quiet stretches
between sentences, snap each boundary to the midpoint of the silence.

# scripts/measure.py (simplified) SILENCE_DB = -38 MIN_GAP = 0.18 # seconds of quiet that counts as a break frames = read_wav(path) quiet = [i for i, db in enumerate(frames) if db < SILENCE_DB] sentences = group_runs(quiet, min_length=MIN_GAP) bounds = [midpoint(s) for s in sentences] # the value the visuals use 

Those midpoints become a timing file:

export const ADURATION = 9878; export const SENT = [ { s: 16, e: 165, text: "You typed example dot com." }, { s: 170, e: 348, text: "Your browser has no idea where that is." }, // ... ]; 

Every scene then asks the timing file instead of a human:

const line = SENT[sentenceIndex]; const lit = frame >= line.s && frame < line.e; 

Re-record a line and the whole film re-times itself. That was the moment the
project stopped being tedious.

Three things this fixed that I didn't expect

1. Captions stopped fighting the edit. When a caption's window comes from
the same file as the code highlight, they can't drift apart. One source of
truth, two consumers.

2. I could cut verticals without re-timing anything. The master and the 9:16
cuts read the same SENT. The verticals are not re-edited — they're the same
composition with a different canvas and a frame offset.

3. Empty air became visible. Silence longer than 0.6s between sentences is
dead weight in a 90-second video. The measurement output showed me exactly where
I was pausing to think, which is editing I'd never have done by feel.

The audio trap everyone hits in Remotion

This one cost me a full day, so here it is plainly.

Remotion's <Audio> uses an HTML5 audio element, and that element renders at a
fixed ~0.707 gain. Setting volume={1.5} does nothing — the tag clamps at 1,
and the multiplied result is still quiet. If you mix voice and music as two
separate <Audio> tags, you get a master that is quiet and inconsistently
balanced, no matter how carefully you set the ratios.

The fix is to stop mixing in the composition:

voice + bed → one wav, pre-mixed → +3 dB with a soft-knee limiter → single <Audio> tag at volume 1 

The encoded file then lands around −18 dBFS with peaks near 0.70, which is where
short-form platforms want it. The 0.707 attenuation is no longer a mystery — it's
a constant you account for once, before rendering.

What I'd tell someone starting today

  • Measure the narration first. Before any scene work. If you animate first, you'll re-time everything twice.
  • Keep one timing file per film, keyed by sentence index, never by frame number. Frames are the output, not the source.
  • Don't put captions at the bottom center of a vertical — that's where the platform chrome sits. Pick a safe band and test it against a screenshot of the real app.
  • Loopable endings matter more than polish. People rewatch a short that ends where it started; that rewatch is what the algorithm actually rewards.

The honest part

I packaged this pipeline as a template and I sell it, so take the above with the
grain of salt that implies. It is React and TypeScript — if you're not
comfortable editing TSX, it is not the tool for you, and a no-code editor will
serve you better.

But the measurement idea is not mine to sell. It's ten lines of numpy and a list
of tuples. Steal it.

If you want the whole thing — the timing system, the code panel, the kinetic
captions, the audio law, the vertical cutdowns — it's here:

If you build the measurement step yourself, I'd genuinely like to see it — the
comments are open and I answer everything.