Repository navigation
Time reel voice-over captions from the spoken words - #60
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonbeside 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."words"caption on a voiced shot takes these timings. If none can be made, the caption keeps the characters-per-second estimate, as before.funkbox/video/transcribe.py:transcribe()accepts audio-only files. Newwords_in()returns a file's words without writing outputs.clip.duration_of()reads the length of any media file.docs/reel.mddescribes the new timing and the fallback.docs/video.mdand the tool description say audio files are accepted.docs/catalog.jsonregenerated (--checkpasses).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).tests/test_voice_timing.py,tests/test_transcribe.py,tests/test_caption_timing.py,tests/test_voice_audit.py,tests/test_audio.py, andtests/reel/r4, r5, r6b and ss4 (72 passed in the reel set).tests/test_server.pyandtests/test_p6_install.pypass. ruff check and format are clean. The full suite runs in CI.Generated by Claude Code