# Live capture — record a live stream from its start; import a file (lane `lane/live-capture`) Asked by the operator on 2026-10-22: start downloading a currently active Rumble stream (and the Kick workaround of downloading the channel and the VOD at the same time), from the stream's start; then "the ability to take an external archive and turn it into a transcribed item … in general, not just a one-off"; then keep markers for a video that is not here yet. ## Findings (measured 2026-10-22) **Rumble.** The embed JSON of a live DVR stream (`live: 2`, `livestream_has_dvr: true`) names one HLS master, `https://rumble.com/live-hls-dvr//playlist.m3u8`, whose variants are `chunklist[_]_i0_DVR.m3u8` on `*.cdn.rumble.cloud`. A DVR media playlist has no `EXT-X-PLAYLIST-TYPE`, 2-second segments (`media___.ts`) and starts at `EXT-X-MEDIA-SEQUENCE:1` — the broadcast's first segment. | Stream | Elapsed | Playlist | Holds | |---|---|---|---| | v7h8pxg (The Quartering) | 18 min | seq 1 … 550, 1100 s | the whole stream; segment 1 served (200) | | v7h7ktg (LFA TV, ~7 h) | ~7 h | seq 5313 … 12511, 7199 segments | the last 4 h (window starts 4 h before now) | | v35waq4 (RT, 24/7) | days | seq 70054 … 77255, 7202 segments | the last 4 h | - **The DVR playlist reaches the start for a stream under ~4 hours old**; past that it is a sliding window of ~7200 segments (4 h). The non-DVR chunklist holds ~2 minutes. - Segments older than the window are still served for a while: on LFA the first served segment rolled from 327 to 352 over ~100 s, ~6.8 h behind the live edge. Not used (see Owed). - The master and the CDN chunklists answer a plain request with a browser UA (no cookies, no Cloudflare); `rumble.com` pages and the embed JSON are behind Cloudflare (yt-dlp needs `--impersonate`). - yt-dlp downloads live HLS with its ffmpeg downloader; ffmpeg's hls demuxer starts at `live_start_index -3` — why a by-hand recording "started from the point I started". With `-live_start_index 0` it starts at the first listed segment (verified: the patched fork opened `media_…_360p_1.ts`; the operator's own `--downloader-args "ffmpeg_i:-live_start_index 0"` recording "worked"). - A browser fallback: Rumble's Cloudflare answers **403** to headless Chromium (old and new headless, with or without the operator's Firefox cookies and UA) and **200** to a headed Chromium under `xvfb-run`, which sees the master playlist. Playwright's Firefox is not installed for the workspace's version. **Kick.** The channel's live playlist (IVS, `playback_url`) holds ~30 s (6 s segments). The ongoing stream's VOD (`kick.com//videos/`; the uuid is the livestream's id in `web.kick.com/api/v1/livestreams`) is an `EXT-X-PLAYLIST-TYPE:EVENT` playlist of 10 s segments from sequence 0 — and every fetch of it ends with `EXT-X-ENDLIST`: a snapshot of the stream so far. ffmpeg (and yt-dlp, which treats the VOD as live) reads one snapshot and stops — the operator's VOD download stops at "now", hence the second download of the channel. Polling the VOD playlist and appending each new segment records the whole stream in one file. ## Rulings - **The fork** (`~/Projects/yt-dlp-patched`, branch `live-from-start`, fast-forwarded into `patched`): `RumbleEmbedIE` marks a live stream's HLS formats `is_from_start` with `downloader_options.ffmpeg_args = ['-live_start_index', '0']` when `--live-from-start` is passed and the stream has DVR (`livestream_has_dvr`, or a `live-hls-dvr` / `_DVR.m3u8` URL) — the Twitch/openrec idiom. Without `--live-from-start` nothing changes; a stream without DVR with it is yt-dlp's own "no formats that can be downloaded from the start". Test: `test/test_rumble_live.py`. Local only, never upstreamed. - **record-live** (`common/controller/recordLive.ts`, job `record-live`, `needsMedia`, queue `record-live::`, never a platform's queue, never the heavy slot): `{slug, url | id, fromStart (true), maxHeight (720; null = tallest), transcribe?, doNotClean?, note?, dryRun?}`. - The record first: `data//` and one `refreshVideoMetadata` pass (writer `refresh`, requestedBy `record-live`). The id is `dataDirIdForUrl` — Rumble's URL id (`v7h8pxg`), not the embed id the metadata carries (`v7f2czy`). A Kick channel URL is resolved to its ongoing VOD (`yt-dlp --flat-playlist --playlist-items 1 kick.com//videos`); the VOD uuid is the id. Not `is_live`/`is_upcoming`/`post_live` → refused. - Path A: `yt-dlp --live-from-start` with the channel's args (cookies, Rumble's impersonation, the pinned UA), `--downloader-args "ffmpeg_i:-live_start_index 0 -m3u8_hold_counters 180 -seg_max_retry 10"`, `--hls-use-mpegts --no-part --fixup never`, `-f best[height<=720]/best`, `--wait-for-video 60` only for an upcoming stream. yt-dlp answering "no formats … from the start" → once more with `--no-live-from-start` (ffmpeg still told index 0). - Path B (Rumble, when the metadata pass or path A is refused — 403/Unable to extract): `liveSniff.mjs` under `xvfb-run -a` (headed Chromium), through the heavy slot with `--estimate 1000`; the master's variant by height (fetched plainly), else the page's DVR chunklist; ffmpeg `-live_start_index 0 -c copy -f mpegts` with reconnect and segment retries. - Kick: the VOD poller (`pollEventPlaylist`, every 20 s, three tries a segment, a missing one a counted gap) and, beside it, yt-dlp on `kick.com/` (`--no-live-from-start`). The poller ends 2 min after the live lane ends without growth, or after 10 min without growth. - Parts are MPEG-TS staging files `..live-..ts` beside the store dir (the store's disk; its root must exist, not be mid-move, and have ≥ 20 GB free). When the stream ends the metadata is read again and the LONGEST part — with any an interrupted run left — is landed; the rest are removed. - Cancel: the recorders get SIGINT (yt-dlp asks its ffmpeg to `q`), SIGKILL after 60 s; what was recorded is landed, the job ends `cancelled`. Progress lines are thinned to one per 5 minutes in the log. - `live-recording.json` beside the record: status, url, platform, parts (method, url, fromStart, times, seconds, bytes, note), the landed part, what the landing kept, the playlist's reach. - **import-media** (`common/controller/importMedia.ts`, job `import-media`, `needsMedia`, queue `import-media:`): `{slug, path, url | id | meta {title, date?, duration?, description?}, move?, replace?, audio?, transcribe?, doNotClean?, note?, dryRun?}`. `url` makes or refreshes the record (one metadata-only pass; a held or cooling platform refuses a NEW record before any job, an existing one lands without the refresh); `meta` writes a record by hand (`extractor: "import"`, history writer `import-media`), id = `id` or the file's name, never over an existing record. A directory, .zip or .7z goes to attach-media (`id` → `match`, else `createRecords`). - **The landing** (`common/controller/landMedia.ts`, shared): ffprobe — unreadable or no audio → refused; a file inside `channels/` or the store → refused (import); KEEP THE LONGER over a stored container (2 s slack, a tie and an unmeasurable store keep what is there; `replace` overrides); finalize into `..land-.part` on the store's disk — attach-media's hashed copy (`copyFileHashed`; a rename when `move` on the same disk) or `-c copy` remux (mp4 +faststart; mkv when mp4 cannot hold the codecs) through the heavy slot; verify bytes (copy) or ffprobe + length (remux); `persistSourceVideo` (`source-media.`, `keepReason: "pin"`, `origin.requestedBy` import-media|record-live); `move` removes the original only after the verify; `audio.` (channel's format, mp3 default) by `transcodeAudio` from the stored container (the tier hook runs there) when there is none or the one there is shorter (a shorter one of another name is removed with `removeMediaFile`); the channel's `archive` gains ` ` (not for a record by hand); `media-import.json` gains the entry (source path, original name, bytes, moved, url, finalized, container, kept, existingSeconds, audio, note; 50 kept). - **import-media composes the existing steps** — the record by `refreshVideoMetadata` (the refresh-metadata op's pass, into a new `data//`), the container by attach-media's copy and provenance (`copyFileHashed`, pointer origin `{kind: "local-archive", archive: , entry: , sha256, attachedAt}` with `requestedBy: "import-media"`) through `persistSourceVideo`, the marker by `setDoNotClean` (keep-videos' writer); a directory or archive is attach-media itself. Its own: one FILE path, the `.part`/`.ts` remux, `move` after the verify, keep the longer, audio, the pending keep marker. A container attach-media attached is protected by the same guard as an imported one (`requestedBy: "attach-media"` counts as landed). - v7h8pxg (the 2026-10-22 recording) was attached by hand before this lane (attach-media + refresh-metadata + keep-videos): nothing to import. - **The hand-off**: the log says what takes the audio — the transcription lane's rules (a leaf matching the channel), or that it does not — and names every hold (workers paused, lane held, channel paused). Nothing lifts a pause. `transcribe: true` queues `whisper-video` (the video page's Transcribe), held like any. - **A later download never clobbers a longer landed recording** (`common/ytdlp/landedGuard.ts`): for a video with a landed entry (or a pointer whose origin is import-media/record-live), downloadOneManaged sets its real audio aside (`.landed-kept`, a scratch name) and keeps the longer after the download; finalizeAppExtraction discards a downloaded container that is not longer than the landed one (and extracts nothing from it). Each decision is a `challenges` entry in media-import.json. - **Keep markers ahead of the record**: `keep-videos {slug, ids, note?, dryRun?}` marks a held id now; an id not held is PENDING in `channels//pending-keep.json` (`{entries: [{id, note, at}]}`) and marked when its record is first written — after every managed download (downloadOneManaged), an import-media landing, a record-live landing (`applyPendingKeep`, which drops the entry). `pendingAll` and the channel's Cleanup stage (**Keep videos by id**) list them. `doNotClean: true` + `note` on import-media and record-live set the marker. - UI: channel page → Media for the whole channel → **Import a file**, **Record live**; video page → Media tools → the same two for that record; Cleanup stage → **Keep videos by id**. The UI does not list live items, so there is no per-item live button. ## Owed - Rumble beyond the 4 h window: segments older than the playlist's window stay served ~6.8 h (rolling); a backfill that enumerates `media___.ts` below the window's first sequence and prepends them was not built. - A recording is a job of the editor's process: an editor restart (graceful) cancels it — the recorder gets SIGINT and the part stays on the store's disk; the next `record-live` of the stream lands the longest of all parts (from the start again, while the DVR window still holds it). A restart that kills the process outright leaves the part too. - The e2e covers Import a file and Keep videos by id; Record live is covered by unit tests only (no fake live yt-dlp in the fixtures). - attach-media (a directory/archive) lands containers without audio; an import of one file does both.