Repository navigation
fix(engine): a video clip starting between frames shows its media on the right frame - #6759
Conversation
Edit accuracy: accurate 271 (base branch 271), smooth 116 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 1 nit · head f5c30900
The non-loop fix holds up, but the start shift makes looped clips drift by a growing amount each cycle (↓ inline, with a repro).
- nit: the body calls the helper
alignClipToFrameGrid; in the code it'salignClipStartToFirstOutputFrame.
Checked
videoFrameExtractor.test.tspasses at head (223 tests). The fails-without-the-fix line names the new test and the failure output.- Loop repro: a throwaway test next to the new describe (gray = 1.4·N source,
extractAllVideoFrames+createFrameLookupTable,timelineEnd: 20), run with the PR'svideoFrameExtractor.tsand then with main's. - CI is green on this head.
…the flake gate under its limit
There was a problem hiding this comment.
Verdict: APPROVE — 1 resolved, 0 open, 0 new · f5c3090 → 8364534
CI note
The required Tests on windows-latest check is red on this head: engine-cli ran past its 16-minute deadline. The engine tests all passed (2621); it timed out partway through the CLI suite, with no test failure. The same timeout hit main itself at c5a5203 and the merge-queue run for #6772, so this PR didn't cause it. Merging still needs that check to go green. Everything else is green, including Flake gate, on this head. Locally, videoFrameExtractor.test.ts gives 222 passed, and the loop test fails with the shift put back.
# Conflicts: # packages/engine/src/services/videoFrameExtractor.test.ts
Fixes #6753
What
A
<video>clip whosedata-startfalls between frames (or a hair before one) now shows source frame N at output frame N, instead of one frame late or with repeated and skipped frames.Why
Extraction samples source frames at
mediaStart + k/fps, anchored on the clip's start. The lookup reads slotfloor((t - start) * fps)for output timet. Whenstartis off the output grid the two grids are out of phase by the sub-frame remainder, so every slot lands one source frame early in time. A start a hair under a frame madefloorflip between neighbours, which gave the repeated and skipped frames.Fix: before the extraction window is resolved,
alignClipStartToFirstOutputFramemoves the clip's start onto its first visible output frame and advancesmediaStartby the same source time (rate lanes shifted likerebaseVideoToWindowdoes). Extraction and lookup share that one origin.Testing
fails without the fix:
a clip whose data-start is off the frame gridrenders a 30 fps clip where frame N is a gray of 3N and reads what output frames 61 to 65 show.Without the fix:
expected [ 60, 61, 62, 63, 64 ] to deeply equal [ 61, 62, 63, 64, 65 ]for 1.95, 1.9667, 2.0001 and 2.0167, andexpected [ 60, 62, 62, 63, 65 ]for 1.999999 (the issue's table).With the fix:
videoFrameExtractor.test.ts223 passed, three runs in a row.What I measured
tsc --noEmitinpackages/engineclean;oxfmtapplied.Looped clips are left alone: moving their start would move the loop origin and shorten every cycle, so
a looped clip keeps its loop origin when the start is off the frame gridpins that a loop shows the same source frame after every wrap (fails with the shift applied:expected 3 to be 1).What I did NOT execute
hyperframes renderof the issue's 1080x1920 project, the producer regression suite, and the Windows and macOS lanes.