Skip to content

Stream capture frames directly to FFmpeg#42

Merged
abrichr merged 1 commit into
mainfrom
agent/direct-ffmpeg-stream
Jul 24, 2026
Merged

Stream capture frames directly to FFmpeg#42
abrichr merged 1 commit into
mainfrom
agent/direct-ffmpeg-stream

Conversation

@abrichr

@abrichr abrichr commented Jul 24, 2026

Copy link
Copy Markdown
Member

What changed

  • stream RGB capture frames directly from memory into a separately provisioned FFmpeg process
  • deterministically fill missing integer PTS slots without relying on wall-clock scheduling
  • embed the logical capture-frame map in a valid MP4 UUID box so nearest-frame extraction keeps its existing semantics
  • bound encoder input with a queue and fail loudly on stalls, short writes, broken pipes, close failures, timeouts, or encoder errors
  • retain verification and atomic promotion while eliminating PNG and ffconcat staging

Why

Capture 1.0.3 removed PyAV from the runtime boundary but temporarily staged every frame as a PNG before final MP4 encoding. That added disk I/O, delayed finalization, and duplicated work. This restores the efficient direct-to-video architecture without bundling codec libraries into the MIT package.

User impact

Recording writes compact video while it runs. Stop/finalization no longer performs a second full image-sequence encode, and no transient screenshot sequence is left on disk. Timestamp lookup remains deterministic and compatible with the compiler.

Validation

  • independent audit: no merge-blocking findings
  • full suite: 324 passed, 7 skipped
  • focused video suite: 28 passed, including real FFmpeg/ffprobe timing, backlog independence, nearest-frame lookup, and faststart remux
  • adjacent capture/runtime suite: 115 passed, 1 skipped
  • Ruff and diff checks pass
  • wheel and sdist archive-boundary validator passes

@abrichr
abrichr marked this pull request as ready for review July 24, 2026 01:03
@abrichr
abrichr merged commit 4eb9b8f into main Jul 24, 2026
12 checks passed
@abrichr
abrichr deleted the agent/direct-ffmpeg-stream branch July 24, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant