feat: VAD silence-trim before transcription to cut Whisper time/cost (#101) #168
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/101-vad-silence-trim"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Per-speaker tracks are silence-padded to full session length, so transcription costs ≈ N speakers × session wall-clock even though each person talks a fraction of the time (a 5-person/4-hour session ≈ 20h of mostly-silent audio). This adds optional VAD trimming: detect speech spans, transcribe only those, and offset the results back onto the session timeline.
Design
ffmpeg silencedetect(zero new Python dep) → parse silences → complement to speech spans → pad 300ms/side → merge overlapping. Fully-silent track → 0 Whisper calls._offset_segmentsadds the span's session-relative start to everystart/end; merged via the existingmerge_attributed_transcript(sorts by start). Proven equivalent to the untrimmed timeline by test./transcribe/sessionendpoint; the VAD path issues one/transcribeper span and merges client-side (server-side merge gives no hook for per-span offsets). Sameverbose_jsonsegment shape.vad_trim_enabled(default off),vad_min_silence_ms(2000),vad_noise_floor_db(-30). Surfaced through the bot-settings schema/GET/PUT and a frontend toggle + inputs.transcribe_sessionwhen disabled/None — no ffmpeg, segments pass through by identity. Tested."VAD trimmed 14.2h -> 3.1h of audio"when the VAD path runs.Note: Dockerfile change (out of original scope, but required)
ffmpegwas only inbot-base, but the Celery audio worker runs the backend image — sosilencedetectwould fail at runtime. Addedffmpegtobackend-base. Slightly widens the backend image; the CIdockerjob validates the build.Verification
Backend full suite 382 passed (+15 VAD tests incl. the timeline-equivalence and OFF-path-unchanged proofs); frontend Admin tests 9/9, full frontend 67/67 (one pre-existing unrelated
react-markdownimport failure in an untouched suite). ruff 0.4.4 clean.Closes #101
🤖 Generated with Claude Code