Skip to content

Pipelines phase 2: captions (PRD and implementation) - #297

Merged
s3rot0n1n merged 12 commits into
mainfrom
t3/issue-247-phase-2
Nov 28, 2026
Merged

s3rot0n1n merged 12 commits into
mainfrom
t3/issue-247-phase-2

Conversation

@s3rot0n1n

@s3rot0n1n s3rot0n1n commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Phase 2 of #247 (#259): Whisper transcription with WebVTT captions (#269), including the audio extraction from #266. Design in docs/prds/pipelines-phase-2.md, implemented in steps on this branch, as phase 1 was.

Closes #269. Closes #259.

Progress

  • PRD, with the QA benchmark (faster-whisper large-v3-turbo int8 chosen over whisper.cpp)
  • Step 1: per-upload override at seal. processing: { videoStreaming, generateCaptions } on POST /media/seal/{mediaId}, MCP seal_media, SDK seal(), CLI --video-streaming / --captions.
  • Step 2: setting, class, background derivative, webhook.
    • generateCaptions per app, and captionsAvailable;
    • the transcribe job class, served only when listed in WORKER_CLASSES;
    • captions never hold up or change a file's processing status;
    • an opt-in media.captions.ready webhook.
  • Step 3: transcription worker.
    • apps/transcribe (the script and a pinned model);
    • the codelit/medialit-transcribe image, built by the release workflow from the same tag's API image;
    • the transcriber interface, with a fake for tests;
    • compose services behind the captions profile;
    • a CI job that transcribes synthesized speech with the tiny model.
  • Step 4: captions job.
    • media.captions: audio extraction, transcription, captions.vtt, transcript.txt and transcript.json, and processing minutes;
    • derivatives.captions.{url, language, files} in REST, MCP, the SDK and models;
    • a <track> and ref forwarding in MediaLitVideo;
    • captions in the dashboard's file details, and in medialit get on stderr;
    • the captions_volume alert.

Before captions reach QA or prod

  • On the QA node: one 1–2 hour file through the script (memory and speed), and room for the image (about 3.3 GB unpacked, 2.1 GB on top of the API image).
  • A sidecar <track> with native HLS on an iPhone (inline and fullscreen).
  • Memory requests on the API and main worker pods (infra).

Testing

Each step runs the unit tests, the database-backed tests and the REST, MCP and CLI integration stack. The stack's worker serves transcribe with the fake transcriber, so the suites check captions on private and public video and on audio uploads, a silent video, and the seal override.

Local browser smoke for step 4, with the real large-v3-turbo model:

  • A 74 s spoken video uploaded from the dashboard: captions in English (15 cues) in 55 s, 2 minutes charged.
  • The HLS video played through hls.js with the private, signed VTT as a <track>, showing the right text at the right time.
  • The file details show the captions and link the three files.
  • An audio file uploaded with the CLI settled ready at seal; its captions followed.
  • medialit get printed the URL on stdout and the captions on stderr.
  • The original's bytes matched, and all three files were served with CORS.

Two real 10-minute talks were then tested locally: one uploaded from the dashboard with HLS, one with medialit upload. Both were captioned in English at about 1.7× real time with 10 minutes charged. Their bytes matched and the captions showed on screen in sync. Two problems found there are fixed in b6c02fe:

  • Punctuation and capitals were missing from most of one talk (351 of 580 s). condition_on_previous_text is now on; with it, that stretch is 0, with no repeats, for about 13% more time.
  • A segment just over one cue left a word or two in a cue under a second long. Cues are now split evenly, which cut those from 9 to 3 and from 13 to 6. The ones left are short phrases the speaker said on their own.

QA (pr-297-b6c02fe images, arm64, through deploy.sh):

  • Browser: sign-in; captions and HLS turned on in settings; a 60-second clip uploaded. It was captioned in English (16 cues, punctuated). It played over HLS from CloudFront with the captions track loaded and in sync, and the file details linked all three files.
  • CLI: medialit login (OAuth in the browser), whoami, settings, an audio upload (ready at seal, captions queued, bytes match), and get with the captions note on stderr.
  • REST: form-data video sealed with processing: {generateCaptions: false, videoStreaming: "off"} gave no captions and no HLS, with matching bytes, size and thumbnail. tus PNG in two PATCHes, with HEAD returning the offset, then matching bytes, size and thumbnail.
  • The transcriber can't run on QA's one node (2 CPU, 3.9 GB, about 1 GB free). The 60-second clip took 8 minutes, 298 s of it loading the model, and the k3s API stalled. Other apps' containers restarted during the run, and all of them recovered. medialit-transcribe is now scaled to 0 on QA. Captions need a node with room (D4).

🤖 Generated with Claude Code

Design for #259 (#266, #269): audio extraction, Whisper captions with
WebVTT, HLS subtitle tracks, caption pricing from the QA benchmark, and
the media.captions.ready webhook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T05:33:46.844084Z 3d104cc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d104cce29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/prds/pipelines-phase-2.md Resolved
Rajat and others added 4 commits November 28, 2026 14:43
… provider

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… no HLS subtitle track, no chunking)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rajat and others added 3 commits November 28, 2026 17:03
…tep 1)

POST /media/seal/{mediaId} takes an optional processing: { videoStreaming },
overriding the app's setting for that upload. Exposed in MCP (seal_media),
the SDK (seal(mediaId, { processing })) and the CLI (--video-streaming on
upload and seal). Sealing again ignores it. media.sealed gains
video_streaming and processing_overridden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…captions.ready (pipelines phase 2, step 2)

- generateCaptions per app (REST, MCP, SDK, CLI --captions, dashboard
  Captions card) and in the seal override; settings report
  captionsAvailable from live transcribe workers.
- New transcribe job class, served only when WORKER_CLASSES lists it
  (WORKER_CONCURRENCY_TRANSCRIBE). jobs_no_worker counts it only while
  captions are queued; transcribe_queue_lag pages after 6 hours.
- captions is a background derivative: it never holds up or changes the
  media's processing status or error.
- New opt-in webhook media.captions.ready, sent when captions settle,
  only to endpoints that list it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…2, step 3)

- apps/transcribe: transcribe.py runs faster-whisper (large-v3-turbo int8,
  Silero VAD) on a 16 kHz WAV and writes timed segments as JSON;
  download_model.py bakes a pinned model revision into the image;
  requirements resolved in the image's Python.
- codelit/medialit-transcribe: the API image plus Python, the transcriber
  and the model, running the worker with WORKER_CLASSES=transcribe. Built
  by the release workflow from the same tag's API image.
- Transcriber interface in the API (faster-whisper through runLimited
  without an address-space limit, and a fake for tests).
- Compose: the transcription worker behind the captions profile, in the
  self-hosting and local files. CI: check-transcriber.sh builds the image
  with the tiny model and transcribes synthesized speech.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@s3rot0n1n s3rot0n1n changed the title docs: pipelines phase 2 PRD (audio extraction and captions) Pipelines phase 2: captions (PRD and implementation) Nov 28, 2026
Rajat and others added 4 commits November 28, 2026 18:27
The tiny model drops plurals ("caption make video"), so CI checks stems.
The full image measured 4.94 GB on disk; it transcribed 74.5 s of speech
in 64 s on 2 CPUs (3.4 s model load) with a 1.73 GB memory peak.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docker images reported 4.94 GB because the containerd image store counts
both the compressed layers and their unpacked copies. Unpacked, it is the
API image (1.2 GB) plus the model (1.62 GB) and the Python libraries
(0.44 GB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck (pipelines phase 2, step 4)

- media.captions in the transcribe class: size check, download, probe,
  no_audio_stream and duration limits, minutes (kind captions), ffmpeg
  extraction to 16 kHz WAV, the transcriber, and captions.vtt,
  transcript.txt and transcript.json under captions/
- Seal plans captions for video (unless audio is known absent) and audio
- derivatives.captions gains language and files; params merge on finish
- captions.made and captions.failed events, transcriber failed log,
  captions_volume alert with a daily cooldown
- MediaLitVideo adds the captions <track> and forwards a ref
- Dashboard file details show captions; medialit get notes them on stderr
- Stack worker serves transcribe with TRANSCRIBER=fake; tests and docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Testing with two real 10-minute talks:

- With condition_on_previous_text off, large-v3-turbo dropped punctuation
  and capitals for most of one talk (351 of 580 s). Turning it on (the
  faster-whisper default) brought that to 0, with no repeats on either
  talk, for about 13% more time. faster-whisper still drops the context
  when a window falls back to a higher temperature, and cleanSegments
  removes repeats that get through.
- A segment just over one cue left its last word or two in a cue of
  their own, on screen for under a second. buildCues now keeps the same
  number of cues and shares the words evenly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@s3rot0n1n
s3rot0n1n merged commit d3f1879 into main Nov 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transcription and captions (WebVTT) Pipelines phase 2: transcription and captions

1 participant