Give it a rendered take and the exact audio the model was sent; get, per take, the most time any 0.4 s of the sent speech gained or lost in the take, where on both clocks, the words there, and where speech starts in each file. A take whose speech matches the audio sent passes. One that stretched a word, stuttered a syllable, said a phrase twice, added a pause or cut a piece out is flagged.
It checks the sound, not the picture: for the mouth against the sound, run
hn4a-lipsync-check; to cut a late take so its line lands on time,
python-find-line-in-render. A changed, missing or extra word is a transcript check
(python-read-word-timings, check).
Inputs
- The takes: the rendered videos, as they came back, with their own soundtrack.
- The audio sent: the very file passed to the model. For a dialogue take that is the one mixed window both speakers were rendered on, never one speaker's line: every false flag in testing came from checking a dialogue take against one voice.
- Word times (optional): the sent file's words on its own clock
(
python-read-word-timings,words), to name what is under a flagged window.
Run it
Write references/reperformed_speech.md's script into the job's scripts/ as
reperformed_speech.py, as is, and run it with cwd the job folder:
exec("python", ["scripts/reperformed_speech.py", "--sent", "audio/shot18.wav",
"--words", "audio/shot18.words.json",
"video/raw/shot18_a.mp4", "video/raw/shot18_b.mp4"], cwd="<job>")
- Several takes of one shot go in one call, all against the same
--sent. --locatewhen the take carries more speech than the file sent (a line checked inside a longer take): it finds the sent speech in the take instead of matching end to end. Without it, extra speech in the take reads as a stretch.
What you get
[{"take": "video/raw/shot18_a.mp4", "status": "flag",
"longer": {"s": 0.19, "at_s": 2.31, "in_take_s": 2.35, "words": ["the", "text"], "flag": true},
"shorter": {"s": -0.01, "at_s": 1.87, "in_take_s": 1.9, "words": [], "flag": false},
"speech_starts": {"sent_s": 0.11, "take_s": 0.11, "late_s": 0.0},
"limits": {"window_s": 0.4, "flag_s": 0.12}}]
status:flagwhen either side is 0.12 s or more; elseok.longer/shorter: the most time gained or lost over any 0.4 s of the sent speech (windows every 20 ms), with where that window starts on the sent file's clock (at_s) and the take's (in_take_s), and the words in it.speech_starts: where speech starts in each file;late_sis the take's late start. Silence at both ends is trimmed before aligning, so a late start or a longer tail is reported here and never flagged: use it to place the line in the cut.
Tips and traps
- Why not word times. Whisper on the same audio twice (232 words) gave a word's length differing by up to 0.87 s (p90 0.16 s), and onsets by up to 1.14 s: a "the" measured 0.19 s, then 1.05 s. Rules on whisper's lengths or gaps that caught a real 0.19 s stretch also flagged 10 to 11 takes, 6 to 7 of them pure noise. This check, on the same 29 takes, flagged 9, every one real.
- The threshold has margin both ways. On 29 real takes, untouched ones stayed at 0.035 s or under, the nearest clean value was 0.08 s and the smallest real edit 0.15 s. Synthetic edits come back within ±0.06 s, the start within ±0.03 s.
- What it caught, in seconds gained (+) or lost (−): an inserted 1.6 s gap with the next phrase re-voiced (+1.58, −0.39); a three-word phrase said twice (+1.11, and +1.02 in the retake made to fix it); a whole line re-voiced and spread to fill the clip (+0.86); one word held long (+0.81); a 0.33 s longer pause between two lines (+0.27); a doubled consonant, "t-text" (+0.19); 0.15 s dropped inside a phrase (−0.15).
- A longer pause is flagged too. No word stretched, but the timing moved; listen and decide. Whether a model is prone to it, and how to send audio it keeps, is in that model's leaf.
- A repeat sits at either copy. When a piece is said twice, the extra time can be
placed on the first saying or the second;
at_sandwordspoint near it, not to the frame. Listen around the window. - A flag is a measurement, not a verdict on its own: listen to the window before
rejecting a take, and to an
oktake as well, since a changed word keeps the timing. - Seconds, not minutes. It runs in well under a second on a 15 s take; no model.
Check it
- Play each flagged take from
in_take_swith the sent audio fromat_s; the difference should be audible. - Transcribe each take you keep and check its words against the lines
(
python-read-word-timings,check): a repeat shows there as extra words.


