Closed bug report

Clip blank check says "could not read frames" on a short clip of an idle window: its seeks land after the recorder's last frame

Drew Owens · ·closed by John Lauer

Versions: adom-aiflow 0.2.48 with local patches that do not touch the clip code (the same blank_check is in 0.2.57 and in the repo head, commit 083ebd94) · Adom Bridge for macOS 1.9.232 · macOS (window capture through the Bridge recorder) · KiCad 10.0 · ffmpeg in the container.

What I did. A KiCad run on a Mac. step silkscreen started a window clip of the PCB editor, I ran silkscreen-audit (offline, nothing on screen), then step 3d about 3 s later stopped and pulled the clip. The editor was painted and idle the whole time.

What happened. The clip is marked suspect:

"step": "silkscreen",
"suspect": "could not read frames"

so it is left out of the video and the page says it "filmed nothing usable". The file is fine: it decodes without an error, it is byte for byte the same as the file on the Mac (sha256 matches after pull_file), and AI Flow's own contact sheet for it shows the painted editor in all nine cells.

Why. The recorder writes frames only when the window changes (AI Flow says so itself at capture open and above clip_artifacts). An idle window gives a clip with all of its frames at the head:

ffprobe -show_entries packet=pts_time,duration_time,size,flags
0.000000,0.030000,98325,K__
0.030000,1.273333,21646,___
1.303333,0.038333,132710,KD_      <- discard-flagged, not decoded
format duration = 1.303333

blank_check (crates/adom-aiflow/src/main.rs, 0.2.57 line 1532) takes media_seconds (1.303 s) and seeks with ffmpeg -ss t -i file -frames:v 1 at 0.08, 0.24, 0.41, 0.57, 0.73, 0.90, 1.06 and 1.22 s. Every seek lands after the last decodable frame (0.030 s), so each returns no pixels, total stays 0, and the verdict is could not read frames. The footage is never judged.

The same run's finish clip shows the seek gap too: frames at 0, 0.03, 1.51, 2.51, 4.01 and 5.02 s, duration 6.02 s, and the 8th sample (5.64 s) reads nothing. There it only costs one sample; on a clip shorter than about 1.5 s of an idle window it costs all of them.

Repro. Any window clip of an idle window that is stopped within a second or two on the macOS recorder; or run blank_check on a file whose last decodable frame is earlier than 1/16 of its container duration.

Expected. A clip that decodes is judged on its frames. "could not read frames" should mean a full decode found no frame.

Suggested fix. Sample by decoded frame, not by container time: for example one ffmpeg pass with the crop and scale and select or fps=8/secs, or, when a seek returns nothing, fall back to a full decode (or the last frame before that time). With a full decode this clip gives painted frames and passes 0.2.57's frame_flat. contact_sheet already samples with the fps filter, which is why the sheet shows the window while the check says it could not read it.

Image: frame 2 of the clip (t = 0.030 s), board area pixelated, with the sampling written underneath.

silkscreen-clip-frame

1 Reply

John Lauer ·

Hi Drew,

Thank you for the packet dump and the sample times. They made the cause plain.

What was wrong. Exactly what you found. blank_check took the container duration and seeked to eight points across it with ffmpeg -ss t -i file -frames:v 1. The recorder writes frames only when the window changes, so an idle window gives a clip whose decodable frames all sit at the head. Every seek past the last frame returned no pixels, total stayed 0, and the clip was called "could not read frames" without its footage ever being looked at. The contact sheet used the fps filter, which is why it showed the painted editor.

What changed in adom-aiflow 0.2.58. The check now samples by decoded frame, as you suggested. It makes one ffmpeg pass with fps=8/secs:start_time=secs/16:round=down before the crop and scale. The fps filter holds the last decoded frame until the next one, so each sample is the frame on screen at that moment. If that still gives nothing (the clip's only frames are before the first sample point, as in yours), it falls back to decoding from the start of the clip. "could not read frames" now means a full decode found no frame. A side effect: a multi-GB clip is decoded once instead of up to eight times (#180).

How it was verified. I built a fixture shaped like yours: two painted frames at the head, and 1.3 s of container behind them that holds no video frame. The old seeks read 0 bytes at 0.08, 0.5 and 1.22 s. The new sampler reads the frames, and blank_check passes the clip. That test is in the suite, next to the existing thin-board and flat-canvas tests, which still pass. The full cargo test run and all the workflow suites pass too.

What is still open. Nothing on this issue. If you already have clips marked suspect with this reason, adom-aiflow recut re-checks them, clears the flag and makes their cuts.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.58.

John Lauer closed this ·

Log in to reply.