Skip to content

Caption controls: font size, timing modes, exact-transcript alignment, hold-last - #4

Closed
zeke wants to merge 5 commits into
mainfrom
feat/font-size-timing-transcript
Closed

zeke wants to merge 5 commits into
mainfrom
feat/font-size-timing-transcript

Conversation

@zeke

@zeke zeke commented Jun 2, 2026 •

Copy link
Copy Markdown
Owner

This PR adds caption controls and timing fixes for word-highlighted captions.

New flags:

  • --font-size N scales caption text.
  • --timing-mode whisper|uniform picks the word-timing source when
    --transcript is used. uniform spreads transcript words evenly across the
    clip, which is steadier on short or noisy clips where whisper's forced
    alignment jumps around.
  • --hold-last keeps the final caption visible until the end of the clip.

Transcript handling:

  • With --transcript, the exact transcript words are displayed and mapped onto
    whisper's word timings, fixing proper nouns that whisper splits into subword
    tokens. A small canonical_word() alias map lets you align alternate
    spellings or pronunciations.
  • Alignment now anchors transcript words that match a forward whisper token span
    and interpolates unmatched runs evenly between anchors, instead of matching
    token-by-token. Highlights stay in sync even when whisper transcribes the same
    sound inconsistently.
  • Blank lines in the transcript force caption line breaks.

Timing robustness:

  • repair_word_timings() drops zero-duration and overlapping word spans that
    made highlight transitions look stuck or skip.

Other fixes:

  • Read whisper .wts output with errors="replace" to tolerate invalid UTF-8.
  • Map the large model family (large-v3-turbo, large-v3, large-v2,
    large-v1) to the dotted --dtw preset names whisper-cli expects.

README updated for the new flags and behavior.

@zeke

zeke commented Jun 2, 2026

Copy link
Copy Markdown
Owner Author

Gonna drop this. Too project-specific.

zeke added 2 commits June 2, 2026 23:16
force_transcript_words now anchors transcript words that match a forward
whisper token span and distributes unmatched runs evenly between anchors,
instead of mapping token-by-token. This keeps word highlights in sync when
whisper transcribes the same sound inconsistently or splits product names
into subword tokens.

_model_short_name maps the rest of the large family (large-v3, large-v2,
large-v1) to their dotted whisper.cpp --dtw preset names, not just
large-v3-turbo.
@zeke zeke changed the title Font size, exact transcript captions, timing modes, hold-last Caption controls: font size, timing modes, exact-transcript alignment, hold-last Jun 3, 2026
…-transcript

# Conflicts:
#	README.md
#	caption.py
@zeke zeke closed this Jun 17, 2026
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