feat(producer): render long videos with windowed source frames behind a flag (#7242)

* feat(producer): render long videos with windowed source frames, behind HF_VIDEO_FRAME_WINDOW

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

* fix(producer): windowed calibration sees real frames, and the late full extraction reports itself

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

* test(producer): windowed frames match a full extraction, frame for frame

Renders ten compositions twice on the segmented route, with and without
HF_VIDEO_FRAME_WINDOW, and compares FFmpeg framemd5 of the two outputs: a
mid-clip start, NTSC 24000/1001, a loop crossing a slice edge, a playback-rate
ramp, a held tail, two clips of one file, a VFR source beside a CFR one, two
workers, auto workers (capture calibration runs), and motion blur, which
declines the window. Each pair must also report the same capture mode.

A separate test samples segment-frames during a four-segment, two-worker
render and holds its peak under workers x segment frames x the largest frame
file x 1.2, and checks the folder is empty once the render closes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(producer): windowed frames test finds its own work dir and asserts what it claims

Find the render's work dir with resolveRenderWorkDirPrefix and the owner record's pid, so
the peak test works on Linux and never samples or deletes a concurrent render's dir.
Assert the measured worker count, calibration, and the exact up-front frame count of the
VFR video. Retry a dead Chrome only with HF_TEST_RETRY_BROWSER_STALL=1, and fail a case
whose windowed render alone needed it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(producer): windowed segments honour keep-segments and cleanup never fails a render

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

* refactor(producer): trim the comments the windowed frames route added

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

* test(producer): the VFR-beside-CFR extraction test moves to the integration lane

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

* chore(producer): raise the package size budget for windowed video frames

The new segment frame modules add about 9 KB to the packed producer package.

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

* test(producer): windowed frames header says what the real runs measured

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vance Ingalls
2026-11-05 11:27:10 -08:00
committed by GitHub
co-authored by Claude Sonnet 5.5
parent 478ef2f26e
commit 968f97fe95
20 changed files with 1677 additions and 52 deletions
+17
View File
@@ -1929,12 +1929,29 @@ mismatched encodes. The directory is deleted after a successful render unless
mp4 and mov only; png-sequence, gif, webm, HDR and shader-transition renders
keep their existing routes.
By default every frame of every source video is extracted before capture
starts. With `HF_VIDEO_FRAME_WINDOW=true`, each segment instead extracts only
the source frames it shows and deletes them when it closes. Things to know
before switching it on:
- Segment files are deleted as soon as they are joined, unless `--keep-segments`
is set. A failure after the join therefore recaptures everything on `--resume`.
- Only mp4 and mov renders that segment honour the flag. Motion blur, variable
frame rate sources and HDR-transformed sources stay fully extracted. The
render log says when the flag was declined and how many videos stayed fully
extracted.
- Source-frame disk use is bounded by roughly workers x `HF_SEGMENT_FRAMES`
frames, and only for videos that can be windowed.
- A windowed render skips the extraction cache, so a re-export gets no
warm-cache speedup.
| Environment variable | Default | Effect |
| ------------------------------ | ---------- | ------------------------------------------------------------------------------------------ |
| `HF_SEGMENTED_CAPTURE` | unset | `true` segments any eligible render; `false` is the kill switch |
| `HF_SEGMENTED_MIN_SECONDS` | off | Segment renders at least this long. Unset means duration never routes on its own |
| `HF_SEGMENT_FRAMES` | `3000` | Frames per segment (~100 s at 30 fps); minimum 30 |
| `HF_SEGMENT_BROWSER_RECYCLE` | `3` | Restart the browser every N segments; `0` keeps one session for the whole render |
| `HF_VIDEO_FRAME_WINDOW` | unset | `true` extracts each segment's source frames when it starts and deletes them when it closes |
#### Render the same composition with different content