Skip to content

Start transcription where the speech starts - #177

Merged
bpacholek merged 1 commit into
mainfrom
captions-start-at-speech
Nov 1, 2026
Merged

bpacholek merged 1 commit into
mainfrom
captions-start-at-speech

Conversation

@bpacholek

Copy link
Copy Markdown
Contributor

Found while making a demo video with the karaoke captions on the 4K talking-head test clip (Polish, Whisper Small).

Problem

The clip's in-point was 0.8 s before the speech. Whisper timed the first words as if the speech began at once: "Witam" was highlighted 0.64 s before it was said, and the words after it were early too. WordTiming.refine only snaps edges within 0.4 s, so it could not fix it.

Change

  • WordTiming.speechStart finds where the speech starts. It looks for the first 0.1 s of sound over the quiet, so a click in the quiet doesn't count, and returns 0.1 s before that. It returns 0 when the sound opens with speech or is too noisy to trust.
  • Transcriber gives Whisper each chunk from that point and moves the words back by the same offset.

Result on the same clip (source seconds)

Word Voice Before After
Witam 6.10 5.46 6.14
odświeżeniu (after the 9.65-10.01 pause) ~10.0 9.46 9.92
rzeczy (after the 17.57-17.96 pause) ~17.96 17.38 17.93

Tests

  • New WordTimingTest.speechStartsAfterTheOpeningQuietAndItsClicks.
  • :ml:whisper:testDebugUnitTest passes and spotlessCheck is clean.
  • Checked on the emulator with the fixed build.

🤖 Generated with Claude Code

Whisper times the first words of a recording that opens with quiet as if
they began at once. On a talk clip whose in-point sits 0.8 s before the
speech, "Witam" was highlighted 0.64 s before it was said, and the words
after it drifted early too, past the 0.4 s reach of WordTiming.refine.

Each chunk now goes to Whisper from 0.1 s before the first 0.1 s of
sound over the quiet (WordTiming.speechStart), and the words are moved
back by that offset. On the same clip the first word now starts within
0.05 s of the voice and the later words land after their pauses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bpacholek
bpacholek merged commit ef6c9ed into main Nov 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant