Repository navigation
fix(engine): extraction waits out the decode up to a deep seek in a long-GOP video - #6583
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits
The required Test check is red on this head. Test (runtime) fails videoFrameExtractor.concurrency.test.ts > lets a cancelled extraction leave the queue while another holds the slot, and it fails 3/3 locally on this head while main passes 3/3. Details inline. (Test reachability failed separately: a checkout timeout, which is infra.)
— claude
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 114 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Video frame extraction sizes each ffmpeg process's no-output timeout on the work in front of its first frame. A seek into a video lands on the nearest keyframe before it, and ffmpeg decodes and discards every frame from there to the seek point without writing anything. The stall clock (
ffmpegProcessTimeout, 300 s) counted that as a hang. The allowance is nowtimeout + (seconds from the keyframe to the seek point) x source fps / 30, a floor of 30 decoded frames per second. A newkeyframeGapSecondsprobe reads the keyframe ffmpeg will land on with a one-packet ffprobe seek (20-40 ms). The final-frame path, which seeks on the output side and decodes from the start, gets the whole start time as its gap.Why
Trimming deep into a long video with few keyframes (a 4K60 screen recording or camera file) failed in prepare with
VIDEO_EXTRACTION_FAILED/ffmpeg_timeout, every time. Each 120 s segment seeks separately, so each one pays the silent decode again.Evidence
Measured on a Linux box, 27-min 3840x2160 60 fps H.264 source with a single keyframe, 60 s window starting 1500 s in:
ffmpeg_timeoutThe same trim on a source with a keyframe every 2 s costs 65-71 s at 10 s, 900 s and 1500 s in: seek depth alone is not the cost, keyframe distance is.
The new test builds a one-keyframe and a one-keyframe-per-second clip and asserts the timeout passed to ffmpeg for a seek 8 s in:
expected 2000 to be 10000on main, passes on this branch 3 of 3 runs; the wholevideoFrameExtractor.test.tssuite passes (217 tests).Why under 100 lines
One probe, one pure timeout formula and two call sites (single pass and per segment); the rest is the test.
Not changed
A genuine hang during that silent decode now takes the longer allowance to be noticed. The 30 fps floor is a conservative software-decode rate; a slower machine would still time out.