feat(demo): upgrade capture pipeline to raw bitmap piping with text-crisp encoding#4785
Merged
gregpriday merged 3 commits intodevelopfrom Apr 2, 2026
Merged
Conversation
…ext-crisp encoding - Replace PNG-file-per-frame capture with raw BGRA bitmap piping to ffmpeg stdin - Add wall-clock ticker with duplicate-last-frame strategy for consistent FPS - Handle stdin backpressure (pause ticker on drain, resume after) - Add HiDPI normalization via image.resize() on first capture - Update encode presets from yuv420p to yuv444p with high444 profile - Add VP9 yuv444p support with row-mt for web-webm preset - Use lanczos scaling algorithm for downscaling - Replace -vsync cfr with -fps_mode cfr (FFmpeg 6.0 deprecation) - Make stopCapture async (awaits ffmpeg close for finalized output) - Update IPC types: outputDir -> outputPath, add preset to start payload - Update preload.cts inline types for new capture API - Rewrite capture tests for piped architecture (34 tests passing)
… validation - Add ticker cleanup and stopping flag to ffmpeg close handler (critical: prevented orphaned interval on unexpected exit) - Add preset validation guard in handleStartCapture - Add test for first capturePage failure rejection
- Fix TS18048 on mock.calls.at(-1) return type
8e82f8b to
b808f24
Compare
Collaborator
Author
|
Capture pipeline rewrite changed frame naming to Regression audit for training data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toPNG()(20-50ms/frame via zlib compression) withtoBitmap()raw BGRA data piped directly into ffmpeg stdin via-f rawvideo -pix_fmt bgra, pushing capture throughput from ~10-15 FPS to 25-35 FPSyuv420p(4:2:0 chroma subsampling blurs syntax highlighting) withlibx264rgb4:4:4 for text-crisp encoding across all three presets; CRF 18 with-preset slow -movflags +faststart--force-device-scale-factor=1 --force-color-profile=srgb, and immediate NativeImage release to reduce GC pressureResolves #4775
Changes
electron/ipc/handlers/demo.ts— full capture pipeline rewrite: raw BGRA piping, ffmpeg arg overhaul, backpressure loop, duplicate-frame fill, close handler cleanup, preset validationshared/types/ipc/demo.ts— preset type updated, newDemoCaptureOptionsinterfaceelectron/preload.cts— IPC bridge updated for new capture options shapeelectron/ipc/handlers/__tests__/demo.handlers.test.ts— comprehensive test coverage for the new pipeline including backpressure, frame timing, encoding presets, and HiDPI handlingTesting
Unit test suite covers all new behaviour: raw BGRA piping, backpressure drain, duplicate frame fill, preset validation, close handler cleanup, and HiDPI scale factor. All tests pass. The formatting and lint checks are clean.