How the pipeline works
View diagram text
flowchart LR
M[clips-monitor<br>Helix poll, category gate,<br>slots, token refresh] -->|desired_capture| R[clips-record@login<br>one per channel]
M --> C[clips-chat<br>one EventSub WebSocket,<br>per-channel detectors]
R -->|segments + PDT manifest| S[(SQLite state<br>/var/lib/clips)]
C -->|candidates| S
S --> W[clips-worker<br>extract, ASR, captions,<br>render, fair queue]
W --> V[clips-web<br>private review + post desk]
S --> D[clips-posts<br>local LLM captions,<br>daily picks]
D --> V
S --> P[clips-report.timer<br>run reports]
T[clips-topclips.timer<br>5 Twitch top clips a day] -->|downloaded clips| S
Timing
Every recorded HLS segment keeps Twitch's EXT-X-PROGRAM-DATE-TIME; chat uses EventSub message timestamps. Both are Twitch clocks, so alignment does not drift with download arrival. Missing spans are stored as explicit gaps (missed_segments, ad, recorder_restart, pdt_jump, chat_disconnected, chat_restart).
Eligibility
Only each streamer's verified category IDs count. Intervals run from the first to the last observation in one category; edges caused by a category change (also between two of their categories) are trimmed by boundary_margin_s. Candidates are clamped to these spans. Stale metadata never extends an interval.
Detection
(per channel): 10 s windows every 1 s, per-sender cap, median baseline of the previous 5 min, trigger at 3x with a unique-chatter floor, onset/peak/end, merge within 20 s, raid and gift-bomb flags. Candidate = 25 s before the reaction onset to 15 s after the peak, mapped from chat time to media time with the measured delivery latency. A restarted chat service primes its baselines from the chat archive.
Processing
One shared worker. Snippet extraction (stream copy) runs first so the source survives raw retention; then ASR (faster-whisper large-v3-turbo on the GPU), speech-aware boundary refinement, captions and an NVENC render (quality-based, with a bitrate ceiling per clip so every file stays under render.max_file_mb, 95). Round-robin across channels; hourly per-channel and global budgets defer (never drop) extra candidates.
Shouting and screaming
(asr.gap_fill*): Whisper's voice filter drops screams over loud gameplay. A second pass transcribes only the gaps the first left, each with about 30 s of audio around it, and keeps a line only if it is confident, not a stock Whisper phrase, not a repeat of nearby speech, and louder than the streamer's normal talking in the clip (game characters and background talk are quieter). On recent clips it added about 2% words.
Webcam layout
(layout.*): clips-posts asks the caption model's vision where the streamer's webcam is on 3 live frames at every stream and recording start, every 30 minutes while recording, and on request (majority kind, median box, in the model's 0 to 1000 coordinates). A webcam goes on top of the clip in a band shaped like the cam; an avatar, camera-only or no-cam stream gets the whole-stream layout. Each clip checks 6 of its own frames for a face inside the box first: no face (the layout changed mid-stream, or the streamer left) means the whole-stream layout and a new measurement. When a new measurement differs, the stream's undecided clips from the last 6 hours render again. Boxes under [render.channels.*] are only used until the first measurement.
Twitch top clips
(topclips.*, clips-topclips.timer): once a day after 08:00, every watched streamer's Twitch clips of the past 24 hours in their categories are ranked together by views (several clips of the same moment count as one), ranks 50 to 100 form the pool, and 5 are picked at random (at most 2 per streamer; skipping moments already used, moments our own recordings already clipped, and clips under 10 s). They are downloaded with streamlink and go through the worker like recorded clips. They are not part of a pilot run, do not use a streamer's hourly budget or change their taste factor, and rank on Posts like a 4x chat spike. clips topclips --dry-run shows what would be picked now.
Measurement
A run (clips run start --days 7) freezes the config hash and code revision and produces daily and final reports, including a random "miss check" sample of non-spike windows to estimate what the detector misses.