Skip to content

feat: add transcribe (whisper) and burn_subtitles (#120) - #151

Merged
TMHSDigital merged 1 commit into
mainfrom
feat/captions-120
Oct 24, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
feat/captions-120

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #120.

What

  • transcribe {input, model?, language?, output?}: aresample=16000,whisper=model=…:format=srt:destination=… (FFmpeg 8, whisper.cpp; nothing leaves the machine). No model is bundled: pass model or set SCREENCAST_WHISPER_MODEL, and the error explains where to get one. Whisper writes to a temp file; then parseSrt → normalizeCues → formatSrt produce the output.
  • burn_subtitles {input, subtitles, style}: subtitles=filename=…:fontsdir=<bundled fonts>:force_style='…' with libass. clean (outlined line) or social (bold on a dark box, raised clear of app UI). Audio copied, via runEditJob.
  • hasFilter(name) in ffmpeg.ts (probed once): both tools explain a missing whisper / subtitles filter up front instead of failing deep in ffmpeg.

Found in testing

  • Whisper's raw SRT numbers cues from 0 and overlaps them (cue 2 started at 2.971 s, before cue 1 ended at 3.040 s). The output is renumbered from 1 and each cue ends when the next begins.
  • The integration helper regionLuma claimed to average a region, but its scale=1:1 used ffmpeg's default scaler, which samples sparsely and missed thin caption text (mean 2 on a clearly captioned frame). It's now a true average, plus a regionMaxLuma for "is text drawn here". The title-card, callout, and redaction checks still pass.

Verified

  • End to end through the server, using Windows TTS speech and the ggml-tiny.en model: 2 cues, "Open the Settings page. Then click the same button to finish the deployment." in ~1.4 s (tiny mishears "save"; larger models do better). Burned in both styles in ~0.5 s and checked visually: Inter, bottom-centred, social on a dark box. No model → clear error with the download link.
  • Unit (captions.test.ts): SRT parsing (CRLF, 0-based, multi-line), renumber and overlap removal against whisper's real output, ordering, hour formatting, model resolution, filter-path escaping, styles.
  • Integration: burned caption present during its cue and absent before it (runs on CI's Ubuntu ffmpeg with libass); transcription runs where a whisper model is configured (locally: passes).
  • Full suite passes; live harness 15/15.

Version 0.25.0; README (35 tools), Pages, mcp-tools.json, ROADMAP, CHANGELOG.

🤖 Generated with Claude Code

transcribe runs FFmpeg 8's whisper filter locally to an SRT, renumbering
whisper's 0-based cues and removing overlaps. burn_subtitles renders an
SRT/ASS with libass in the bundled font, in clean or social style. Missing
whisper/libass support and missing models are explained up front.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 24, 2026
@TMHSDigital
TMHSDigital merged commit 46df92a into main Oct 24, 2026
8 checks passed
@TMHSDigital
TMHSDigital deleted the feat/captions-120 branch October 24, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Captions: transcribe (FFmpeg 8 Whisper filter) and burn_subtitles

1 participant