Skip to content

Time reel voice-over captions from the spoken words - #60

Merged
IsraelWebDev merged 1 commit into
mainfrom
reel-vo-timing
Nov 22, 2026
Merged

IsraelWebDev merged 1 commit into
mainfrom
reel-vo-timing

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

Why

The reel's voiced captions were spread evenly over the voice (characters per second), so the highlighted word could drift from the speech. This is the reel voice path item left open in the whisper plan (T-3).

What changed

  • funkbox/reel/voice_timing.py (new):
    • line_words(wav, say) transcribes each spoken line once with faster-whisper and caches the words as <wav>.words.json beside the voice file. Hebrew lines use the Hebrew default model (large-v3); others use small. Without faster-whisper it returns None and nothing is cached, so a later install is used.
    • caption_timings(...) aligns the transcript to the approved caption text (captions.word_timings), then moves the words from the voice's start onto the caption's own clock.
  • Reel renderer: a "words" caption on a voiced shot takes these timings. If none can be made, the caption keeps the characters-per-second estimate, as before.
  • Shot length is unchanged: it is still the voice's own duration.
  • funkbox/video/transcribe.py: transcribe() accepts audio-only files. New words_in() returns a file's words without writing outputs. clip.duration_of() reads the length of any media file.
  • Docs: docs/reel.md describes the new timing and the fallback. docs/video.md and the tool description say audio files are accepted. docs/catalog.json regenerated (--check passes).

How it was tested

  • tests/test_voice_timing.py (nine): Hebrew and English language choice; the caption clock offset when the voice starts at 0.1 s and at 0.4 s; no match means no timings; the cache is read back and no transcription runs; without faster-whisper the estimate stays and nothing is cached; a non-media file is refused before any model loads.
  • tests/test_transcribe.py: an audio-only file is transcribed (needs faster-whisper, like the other transcribe tests).
  • Locally: tests/test_voice_timing.py, tests/test_transcribe.py, tests/test_caption_timing.py, tests/test_voice_audit.py, tests/test_audio.py, and tests/reel/ r4, r5, r6b and ss4 (72 passed in the reel set). tests/test_server.py and tests/test_p6_install.py pass. ruff check and format are clean. The full suite runs in CI.
  • Not run here: a voiced reel rendered end to end with Kokoro and faster-whisper, since the voice models are not installed in this sandbox. The alignment and offset are covered by unit tests; the render wiring is checked by the reel suites above.

Generated by Claude Code

A voiced reel shot used to spread its caption evenly over the voice
(characters per second), so the highlighted word could drift from the
speech. Now, when faster-whisper is installed, each spoken line is
transcribed once, the transcript is cached beside its wav, and its words
are aligned to the approved caption text, so each word appears when it
is said.

- funkbox/reel/voice_timing.py (new): line_words (cached transcript,
  None without faster-whisper so the estimate stays) and caption_timings
  (moves the words from the voice's start onto the caption's clock).
- reel render: a "words" caption on a voiced shot takes these timings.
  Shot length is unchanged: it is still the voice's own duration.
- transcribe accepts audio-only files; words_in returns the words of a
  file without writing outputs. duration_of reads the length of any media.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit 6978ec0 into main Nov 22, 2026
4 checks 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.

2 participants