Skip to content

fix: size ffmpeg timeouts to the file; input-seek re-encode (0.1.2) - #9

Merged
joepetjr merged 1 commit into
mainfrom
fix/large-master-timeouts
Oct 27, 2026
Merged

joepetjr merged 1 commit into
mainfrom
fix/large-master-timeouts

Conversation

@joepetjr

Copy link
Copy Markdown
Contributor

What

Release 0.1.2. Every ffmpeg and ffprobe step's timeout now grows with the file it reads, and the re-encode fallback seeks on the input side.

  • io_timeout(floor_sec, nbytes) and MIN_IO_BYTES_PER_SEC (20 MB/s). The keyframe probe (600 s floor), the stream copy (1800 s floor) and the concat (1800 s floor, double the bytes with faststart) use it instead of a flat window.
  • reencode_range runs ffmpeg -ss S -i master -ss 0 -t D …. The demuxer jumps to the keyframe before the cut, and accurate seek drops frames up to the exact start. The output-side -ss 0 drops the stream-copied audio's pre-cut packets. Without it, the concat demuxer plays about half a GOP of audio from before the cut; the integration suite caught this. The timeout is max(timeout, D × 20) (REENCODE_SEC_PER_SEC).
  • 0.1.2 also releases the unreleased fix(segments): reject negative and non-finite durations #7 and fix(keyframes): expire cached probe failures so they can recover #8. __version__ was still 0.1.0 and now matches pyproject.

Why

GoMoveShift's Ace Basin day master is 110 GB on a 9p mount. On 2026-10-27 at 12:10 ET, probe_keyframes hit the flat 600 s timeout, so keyframes came back unknown. Every long-form range then fell to reencode_range. That path used an output-side seek, decoding the master from byte 0 for every range, under a flat 3600 s timeout. LF1 has 8 ranges, up to 1147 s each, through x265 -preset slow, so each range would run for hours or time out.

Tests

  • New tests: the probe window scales with a sparse 118 GB file. The copy, re-encode and concat timeouts scale with size or length. The re-encode argv has an input seek, -ss 0 after -i, and -t.
  • Real ffmpeg: the accurate-seek re-encode gives exactly 60 frames, and the output is 2.0 s with no audio leak. The re-encoded and copied neighbours concat to 5.0 s.
  • pytest -q: 152 passed. ruff check .: clean.

After merge

Tag v0.1.2 on the merge commit. Then framegrade bumps its keycut pin (pyproject.toml:112) and releases.

A 110 GB day master on a 9p mount took longer than the flat 600 s keyframe
probe, so keyframes came back unknown and every range fell back to a
re-encode that decoded from the start of the file under a flat 3600 s
timeout. Probe, copy and concat timeouts now scale with the bytes read at a
20 MB/s floor; the re-encode seeks on the input side with an output-side
-ss 0 so copied audio carries no pre-cut packets, and its timeout scales
with the range length. Releases 0.1.2.
@joepetjr joepetjr added the needs-operator Autoland hard-denied this PR; human merge required label Oct 27, 2026
@joepetjr

Copy link
Copy Markdown
Contributor Author

Hard-denied (hard-deny: protected path family) and ready to merge -- all checks green.

Offending paths:

  • pyproject.toml

Human merge:
sudo gh-merge-approved 9 --repo Back-Road-Creative/keycut --wait --yes

@joepetjr
joepetjr merged commit a1bba80 into main Oct 27, 2026
4 checks passed
@joepetjr
joepetjr deleted the fix/large-master-timeouts branch October 27, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-operator Autoland hard-denied this PR; human merge required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant