Transcript-Driven Cutting — a HyperFrames add-on
Where this sits. HyperFrames is the open-source HTML→MP4 video studio: install it, drive it with your own local Hermes agent and your own model, and you can edit footage, build motion graphics, add voiceover, render MP4s and publish them — the whole HyperFrames toolset, on your hardware, with the rushes never leaving the machine. What that agent lacks is an ear. This add-on supplies it: Hermes transcribes the raw videos first, gets word-level timings, and therefore makes better editing decisions — cuts on sentence boundaries, air where it meant to put air, captions that cannot drift from the picture.
Adopt it when you already use HyperFrames (or want to): everything below feeds that workflow. The transcription and phrase-finding steps are editor-agnostic, so they are useful even if the final render happens somewhere else.
A video agent has no ears. It cannot watch a file and know where a sentence starts; it can only guess, and a guess is what produces a cut that begins on the last phoneme of "and", or two seconds of dead air before anyone speaks.
So transcribe first, locally, and every editing decision downstream becomes a number instead of an estimate.
- "About seven seconds in" becomes
12.840 - 13.200. - A cut lands on a word boundary because the boundary is written down.
- Air before and after speech is a value you chose, not a value you got.
- Captions come from the same data, so they cannot drift from the picture.
Nothing here calls a cloud service. Both engines run on your CPU, on your machine, for free, and the audio never leaves it.
When to Use
Use this skill when the work is choosing which parts of a recording to keep:
- cutting a long talk, interview or screen recording down to a short
- removing false starts, filler, or a bad take and keeping the retake
- reordering spoken segments into a cleaner narrative
- captioning the result from the same timings that drove the cuts
- proving, after rendering, that the speech boundaries are where the transcript said
Not for producing a faithful written document of an audio file. That is the transcribe
skill: same Whisper family, different goal. If the deliverable is text, use transcribe.
If the deliverable is picture and sound edited against those timings, use this.
Two Engines, Both Local
Pick one per job. They write comparable word-level data, so the rest of the pipeline does not care which ran.
| Parakeet | Whisper sidecar | |
|---|---|---|
| Where | inside the HyperFrames CLI | scripts/asr.py in this skill |
| Install | hyperframes models install parakeet |
pip install faster-whisper |
| Run | hyperframes transcribe FILE -e parakeet --json |
asr.py transcribe FILE |
| Speed | ~7x realtime on a 14-core CPU | ≈ realtime on 6 CPU cores (small.en) |
| Output | transcript JSON written beside the file | transcript JSON, SRT on request |
| Word key | text |
word |
| Needs a project | yes, one already set up | no, any file anywhere |
| Languages | strong English, decent European | any language Whisper supports |
| Best for | long footage inside an existing edit | a one-off file, non-English, subtitles |
Parakeet is the faster path when you are already working inside a HyperFrames project.
asr.py is the path when you have a file and no project, when the audio is not English,
or when you want an SRT out of the same pass.
Two schemas, one reader. The engines disagree on one key: asr.py writes a word's
surface text as word, Parakeet — and most Whisper tooling in the wild — writes it as
text. find and clips accept either, so a transcript from the other engine needs no
conversion:
{"words": [{"text": "He", "start": 0.0, "end": 0.16}]}
{"words": [{"word": "He", "start": 0.0, "end": 0.16}]}
Both start and end are required either way; segments are read the same way
(text, or word if a tool says so) when there is no words array.
Pipeline
probe -> extract 16 kHz mono -> transcribe to word-level JSON
-> locate the phrase (asr.py find)
-> cut list -> clip markup (asr.py clips)
-> render -> verify with silence detection
1. Probe the media
Never trust the extension. ffprobe says what is actually inside, and whether there is
an audio stream at all — a screen recording with a muted track is a common surprise, and
it is better to learn that before a five-minute model run.
ffprobe -v error -print_format json -show_format -show_streams take.mp4
asr.py transcribe does this for you and refuses a file with no audio.
2. Extract 16 kHz mono audio
Whisper's native rate is 16 kHz mono; anything else gets resampled on the way in. Do the conversion once, explicitly, into a WAV you own:
ffmpeg -nostdin -v error -y -i take.mp4 -vn -ac 1 -ar 16000 -c:a pcm_s16le audio.wav
3. Transcribe to word-level JSON
<venv>/bin/python scripts/asr.py transcribe take.mp4 --model small.en --srt
# -> take.transcript.json beside the file, plus take.transcript.srt
Output shape (abridged):
{
"schema": "asr.transcript/1",
"source": "take.mp4",
"model": "small.en",
"language": "en",
"duration": 486.2,
"segments": [{"id": 0, "start": 0.0, "end": 4.88, "text": "..."}],
"words": [
{"start": 0.0, "end": 0.28, "word": "The", "probability": 0.62},
{"start": 0.28, "end": 0.66, "word": "first", "probability": 0.97}
]
}
The words array is the whole point. Segments are for reading; words are for cutting.
Read the surface text from either key — word (this script) or text (Parakeet,
Whisper tooling) — so a transcript from the other engine drops straight into find and
clips with no conversion step.
Model size, for cutting (CPU, int8):
| Model | Disk | Use it when |
|---|---|---|
tiny.en |
~80 MB | you only need to find obvious phrase boundaries |
base.en |
~150 MB | clean speech, nothing hangs on one word |
small.en |
~480 MB | default for cutting: boundaries good, still fast |
medium.en |
~1.5 GB | a single word matters — a name, a figure, a quote |
Do not reach for medium.en out of habit. It is several times slower, and the extra
accuracy mostly shows up inside long proper nouns, not at boundaries. Reach for it when
you are cutting around a claim and the exact wording will be quoted.
4. Locate the phrase
<venv>/bin/python scripts/asr.py find take.transcript.json "the second failure" --context 3
phrase: the second failure
1 match in take.transcript.json
[1] 2:41.680 in 161.530 out 164.120 (2.590s, exact)
...and that is why I want to talk about
>>> the second failure, which nobody
...instrumented at all
Exact match on lowercased, punctuation-stripped words first, because two numbers that
agree exactly cannot be wrong. When nothing matches exactly — the transcript says
"there's" and you typed "there is" — it falls back to a similarity score over same-length
windows, and labels the result fuzzy 0.93 so you know to look at it. --json for
machine use, [n] / --index to pick between repeated phrases.
The printed first word / last word matter: if the match is fuzzy, read them.
5. Build the cut list
One cut per line, # for comments, in the order you want them on the timeline:
# opening: the failed take
The first take was unusable # a phrase, resolved against the transcript
recorded in a quiet room [2] # the second time it is said
161.530-164.120 # or an explicit source range
A phrase is snapped outward to whole words, because a cut through a word is the one class of mistake a listener hears every single time. A range you typed is the opposite case: it is taken exactly as written, to the frame, because you already made that decision.
6. Turn the cut list into clip markup
<venv>/bin/python scripts/asr.py clips take.transcript.json --cut-list cuts.txt \
--fps 25 --gap 0.25 --out take.clips.html
<video id="clip-00" class="clip" data-start="0.00" data-duration="2.12" data-media-start="0.00" data-has-audio="true" data-volume="1" src="take.mp4"></video>
<video id="clip-01" class="clip" data-start="2.37" data-duration="2.08" data-media-start="7.36" data-has-audio="true" data-volume="1" src="take.mp4"></video>
That is HyperFrames clip markup: one timed <video> element per clip, and nothing else on
stdout, so it pastes straight into a composition. Each number has one meaning:
data-start— where the clip lands on the finished timeline.0for the first, then the previousdata-start+ previousdata-duration+--gap. The gap lives in the offsets, so there is no separate gap element to keep in step.data-duration— out − in.data-media-start— the source in-point, which is the trim.data-has-audio="true"anddata-volume="1"— the speaker's own sound is the point, so the element is nevermuted.
id is unique and zero padded (clip-00, clip-01, …), src is the --source value
verbatim, and every value carries two decimals. The audit comment lines and the --stats
timeline summary go to stderr; --out writes the same clean elements to a file and leaves
stdout empty.
--fps (default 25, 0 disables it) lands transcript timings on the frame grid, moving a
boundary by less than half a frame — a cut at 7.373 is not a cut at 25 fps, it is 7.36 with
a rounding error waiting to appear in a render. A range you typed is not re-timed at all:
honoured as given, to the frame. --lead (0.15 s) and --tail (0.25 s) set the air around
a phrase cut and never touch a typed range unless you pass them yourself. Leave them
alone unless you have listened and disagree.
7. Render, then verify with silence
This is the step that turns "I think the cuts are right" into evidence. Feed the rendered
file to silencedetect; it reports where the audio actually falls quiet.
ffmpeg -nostdin -i render.mp4 -af silencedetect=noise=-32dB:d=0.35 -f null -
silence_start: 2.119909
silence_end: 2.473469 | silence_duration: 0.35356
silence_start: 4.084263
silence_end: 4.458231 | silence_duration: 0.373968
Read it against the markup above: the first silence_start is 2.119909, which is clip
1's data-start + data-duration — 2.120 — to the millisecond. The picture changed where
the transcript said it would. If a silence_start lands 0.4 s before the number you
planned, a cut is early and you fix the number, not the listener's patience.
-32dB is the threshold that separates speech from room tone on ordinary recordings;
d=0.35 ignores the natural pauses inside a sentence, so only real boundaries are
reported. Raise d to 0.5 if you get a report per comma.
Reading the Numbers Honestly
Two properties of word timestamps shape every decision, and both are worth internalising:
Word timings are contiguous. Word N ends where word N+1 begins, so a transcript contains no "gap" between words to borrow air from. The tail of a word's span is its release — quiet, inaudible as a fragment — so the lead air is allowed to borrow at most 40% of the previous word and no more. That is why a cut that looks like it has 0.15 s of air may really have 0.09.
Boundaries are approximate at the edges of speech. Whisper is usually within 50-80 ms on a clean recording and worse on one recorded in a room with a fan in it. Do not build a rhythm that depends on 20 ms; do build one that depends on 200 ms, which the data can actually support.
Pitfalls
- Handing the model a path instead of samples. faster-whisper's path-based decode
goes through PyAV, and on
av >= 15that path raises on files ffmpeg reads happily. Always feed float32 samples decoded from a WAV you made yourself.asr.pydoes this; do not "simplify" it back tomodel.transcribe("file.mp4"). - VAD off. With voice-activity filtering disabled, the decoder invents fluent
sentences over music beds and room tone. A hallucinated word is worse than a gap,
because it looks like data. Leave VAD on;
--no-vadexists only for diagnosing it. tiny.enis confidently wrong. On a synthetic test clip it rendered "hissed all through it" as "is toil through it" — grammatical, plausible, invisible unless you read the transcript. A bigger model is not a guarantee either: on the same clipsmall.endropped the word entirely and produced "the microphone is all through it". Read the words around a cut before you trust them, and if the line will appear on screen, cut around a lower-confidence word rather than through it.- The first run downloads the model. A few hundred MB into the Hugging Face cache, once. It looks like a hang for the first 30-60 seconds; it is not.
- Float16 on CPU fails.
ValueError: Requested float16 compute type...— the compute type must beint8on CPU. Never remove that argument. - Segment text is not cut text. Cutting on segment boundaries gives you whatever length the decoder chose, usually 5-15 s, including the half-sentence it padded with. Cut on word boundaries; segments are for orientation.
- A cut can hide a word without deleting it. If
data-media-startanddata-media-start + data-durationboth fall inside the same word's span, the clip is a fragment.clips --statswarns below 0.4 s. - Long files.
small.enruns at about realtime on six CPU cores — measured: a 9.5 s clip decodes in 12-16 s including model load, andtiny.entook 4.7 s. So a 45-minute recording is a 45-70 minute job: run it in the background and say so, rather than blocking a conversation. - Two clips from the same source can overlap. If clip 2's lead reaches back into clip
1's tail, the same second of audio plays twice.
clipswarns; the fix is a smaller--lead, not a smaller--gap.
Verification Checklist
-
ffprobeconfirmed an audio stream before the model run - transcript JSON has a non-empty
wordsarray (wordortextkeys) and the language is right - every
findresult was read, not just used —exactorfuzzy 0.9x - no phrase cut lands inside a word's span (a range you typed is yours to judge)
- clip durations are plausible for speech (0.4 s floor)
-
silencedetecton the render reports boundaries matchingdata-start + data-duration - audio and picture are cut with the same numbers — a video-only trim desynchronises
Files
| File | Purpose |
|---|---|
scripts/asr.py |
transcribe, find, clips — one file, standard library plus the model runtime |
README.md |
Install prompt, worked example, and the reasoning |
.gitignore |
Keeps model weights, venvs and real transcripts out of the repo |