Repository navigation
fix(cli): snapshot fails when an on-screen video frame cannot be read - #7011
Conversation
There was a problem hiding this comment.
Requesting changes at 3a7f890f. There are two blockers.
1. A valid HEVC clip held past its source end now fails snapshot, and the message calls it unreadable. Repro on Linux, using the harness from snapshot.unreadableVideo.browser.test.ts with a real clip in place of the text file:
clip.mp4is a 1 s libx265 clip (-tag:v hvc1) withdata-start="1" data-duration="3". The snapshot is taken at--at 3.5, so the clip is still on screen after its source has ended.- On this head:
{"ok":false,"error":{"message":"✗ 1 video frame(s) could not be read, so those videos are black or stale…"}}, exit 1. - On the base
d17b9583:ok: true, with only the "frames missing" warning. - Controls: the same HEVC clip at 1.5 s passes, and an H.264 clip at 3.5 s passes. H.264 passes because Chrome knows its
srcDuration, soholdLastFrameis set.
Cause: headless Chrome on Linux can't decode HEVC, so srcDuration is 0 and holdLastFrame stays false. probeContainingSourceFrameSeek then returns null for time >= format.duration, and the new counter treats that null the same as a probe or extract that failed. The file can be read fine. The snapshot just has no last frame to hold. Phone footage is very often HEVC, so this turns a still that was previously a bit off into a hard failure for valid projects, which is the reverse of what the PR is for. Possible fixes: decide past-end holding from the probed format.duration when the browser gives no duration, or count only FrameExtractError and missing input as unread, not the past-end null. Please also add a test for this case.
2. The Comments workflow fails on this head. It's the comment-share ratchet: snapshot.ts 136→137 and ffprobe.ts 204→205, one added comment line each. In ffprobe.ts, the new JSDoc is stacked under runFfprobe's existing /** Spawn ffprobe… */. That orphans runFfprobe's doc onto inputPathArg. Moving inputPathArg (with its doc) above that block fixes the doc placement. You still need to cut one comment line in each file to get under the ratchet.
Verified OK:
- Both tests on the
fails without the fix:line fail at the merge base and pass with the fix. The strict-ffprobe test fails withUnable to find a suitable output format for '--'. The browser test fails withexpected true to be false. inputPathArg("-")→./-no longer goes to stdin, which is fine.
Edit accuracy: accurate 271 (base branch 271), smooth 110 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
|
Pushed 1712123.
|
There was a problem hiding this comment.
Approving at 17121230. Both blockers from my review at 3a7f890f are cleared:
- The HEVC clip held past its source end no longer fails. An on-screen frame now counts as unread only when
frameOrWarnrecorded aFrameExtractError, so a past-endnullfrom the seek probe stays a warning. The new test "does not fail for a readable clip held past the end of its source" is the repro from my review. Commentspasses.runFfprobe's JSDoc is back onrunFfprobe.
Verified locally at this head:
snapshot.unreadableVideo.browser.test.tspasses 2/2 andsnapshot.test.tspasses 98/98.- With the counter guard reverted to
unreadVideoFrames += 1, the new test fails withexpected false to be true. All threefails without the fix:tests are confirmed: the other two failed at the merge base, as I checked in the earlier review.
Non-blocking nit: warned is a snapshot of the shared warnings array, but up to 4 extractions run at once. A past-end null from one clip can be counted when another clip fails at the same moment. The command fails either way because of the real failure, so only the reported count can be inflated. A per-call flag, such as catching inside the callback, would make the count exact.
Other CI on this head was still running when I approved.
…n an unreadable one
…n an unreadable one
1712123 to
184448a
Compare
|
Pushed (rebased on main), narrowed to the loud failure. The helper that replaced What remains is the part that stands alone: a frame that could not be read now fails the snapshot, with both guard tests described in the body. Unit (123), the two browser files x3, the contract test, tsc and oxfmt pass on a clean run. |
There was a problem hiding this comment.
Approving at 184448a7. The scope is now the unread-frame failure only. The -- removal and inputPathArg are gone, and snapshot.test.ts, ffprobe.ts and ffprobe.test.ts match main.
Verified locally at this head (merge base cd598426):
snapshot.unreadableVideo.browser.test.tspasses 2/2 andsnapshot.test.tspasses 97/97.fails without the fix:holds. Withsnapshot.tsat main, "fails, naming the folder, when a video on screen cannot be read" fails withexpected true to be false. The HEVC held-past-end guard still passes there.- The
snapshot.tschange is the same counter and failure I approved at17121230: a frame counts only whenframeOrWarnrecorded a warning. Commentspasses.
If any ffprobe does reject --, those probe errors now make the snapshot fail loudly instead of passing black. That's consistent with this PR, and the error names the cause.
The non-blocking nit still stands: warned snapshots a warnings array shared across 4 concurrent extractions, so the reported count can be inflated when a real failure happens at the same moment. Other CI on this head was still running when I approved.
hyperframes snapshotno longer finishes "complete" when an on-screen video's frame could not be read; it fails after saving the stills, so an agent reviewing the sheet is told instead of looking at black or stale videos.Cause
When a video's frame fails to read (a probe or extract error),
snapshotwarned and carried on, then exited 0 withok: true. The warning is easy to miss; the sheet looks like a finished review.Change
snapshotcounts on-screen video frames whose read raised that warning. After saving the stills it fails (exit 1,ok: falsewith--json), naming how many frames and the folder they were saved to. A video with no source at all, and a readable clip held past the end of its source (no last frame to hold, as with HEVC in headless Chrome on Linux), stay warnings, as before.Test
fails without the fix:
clip.mp4is not a video; red when the failure is removed)Guard: the same file's "does not fail for a readable clip held past the end of its source" (a 1 s HEVC clip shown to 3.5 s) is red if every missing frame is counted as unread.
Checked on a clean run: the two snapshot browser files pass 3 runs in a row (4 tests), snapshot and contact-sheet unit tests pass (123), the ffprobe argv contract test passes, tsc and oxfmt clean.
Not changed: the
--before the input in the engine and snapshot ffprobe calls stays, as the argv contract test requires. An earlier version of this PR replaced it with a helper; that is kept aside until the question of whether any ffprobe rejects--is settled.Size
About 100 changed lines: one counter and one failure in
snapshot.ts, plus two tests.