Skip to content

Commit 4199b03

Browse files
alexarjeclaude
andcommitted
Handover: the framecount ceiling, 1.14.1, and the tracks resolution
A second fault of the same shape as the quadratic one: get_framecount's flat 10 s timeout meant MGT could not OPEN a video longer than about twenty minutes, and the fallback escalated to a slower method so it could never recover. Found because the overnight run died instantly. Both bugs were invisible on a clip and fatal on a session, and neither changed a number. MGT's suite is entirely short-clip, so nothing in it could have found either --- which is the argument for the property tests added rather than for a two-hour fixture in CI. Also records 1.14.1, the two slips in cutting it, and that _tracks' non-determinism was two output specs feeding one stdout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xg1f739wddu5M4s3UwdNkn
1 parent 38235d3 commit 4199b03

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎plans/2026-08-24-handover.md‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,49 @@ it recording the command and the elapsed time. About 1.4 h expected.
184184

185185
That gives the motion envelope the hierarchy and the audio-video timing both need. The
186186
videogram pyramid waits for `_tracks` to have tests that catch what its author did not.
187+
188+
## And a second fault of the same shape: long videos could not be OPENED
189+
190+
Found because the overnight run died instantly. `get_framecount` gave ffprobe a flat
191+
**10-second timeout** and, on timeout, escalated to `-count_frames` --- which fully decodes
192+
and is far slower --- so that timed out too and raised. A ceiling on video length with
193+
nothing to do with any analysis.
194+
195+
Counting packets on the 2 h 38 min recording takes **22 s**, so `MgVideo()` raised
196+
*"Could not count frames. (Is this a video file?)"* on an ordinary MP4. Anything past
197+
roughly twenty minutes was unopenable. It opens in 21 s now and reports 475,680 frames.
198+
199+
The allowance scales with the file (`framecount_timeout()`, separate so a test can shorten
200+
it and exercise the real path against a real ffprobe), and a timeout falls back to the
201+
container's `nb_frames` with a `RuntimeWarning` instead of escalating. Four tests, which
202+
error on the old code.
203+
204+
**These two bugs share a shape and that is the lesson.** Both were invisible on a clip and
205+
fatal on a session, and neither changed a number. MGT's suite is entirely short-clip, so
206+
nothing in it could have found either. The property tests added here --- count the
207+
allocations, shorten the timeout --- are the cheap way to cover that class without a
208+
two-hour fixture in CI.
209+
210+
## Released 1.14.1
211+
212+
The quadratic fix, byte-identical, on PyPI. CI green on the release commit *before* the
213+
Release was created, which is the rule this handover records being broken earlier the same
214+
day. The framecount fix is on master and unreleased.
215+
216+
*Two slips of my own in that release, both in the commit record.* The changelog entry the
217+
fix commit claimed to add was never added: a `str.replace` targeted an `## [Unreleased]`
218+
heading that 1.14.0 had already consumed, matched nothing, and the script printed "changelog
219+
updated" unconditionally --- a success message not conditional on success. And I nearly cut
220+
the release from the wrong branch, because the notes extraction kept returning nothing while
221+
I was still on `tracks-wip`.
222+
223+
## `_tracks.py`: the non-determinism is solved
224+
225+
`ffmpeg_cmd(pipe="read")` appends its OWN output arguments, and the module had appended its
226+
own. ffmpeg was given two outputs and wrote both into one stdout, interleaved --- wrong
227+
values, and different between runs because interleaving follows buffering. Serial extraction
228+
is now byte-for-byte equal to `mg_motion` over 6,005 frames of 1080p.
229+
230+
**The parallel path is still not exact**: one repeated frame at the last chunk seam, because
231+
`-ss` before `-i` lands on a keyframe and the frames decoded before the target are not always
232+
the single one the worker drops. Seven interior seams are exact. Do not use it until that is.

0 commit comments

Comments
 (0)