Repository navigation
fix(windows): write a key frame every second in captures - #1540
EtienneLescot wants to merge 1 commit into
Conversation
The helper left the H.264 GOP at 0, which lets each vendor's encoder choose. Some emit a single key frame at the start of the take. The editor seeks to the key frame before its target and decodes forward, so on such a file every seek, cut and pause decodes from the start: a seek 8 minutes into a 10-minute 1080p60 take measured 78.6 s, against 0.44 s with a key frame every second. Set CODECAPI_AVEncMPVGOPSize to the frame rate, for the screen and the camera. A helper test checks the spacing on both encoders. Refs #1475
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Summary
Likely cause of #1475: the Windows capture helper never sets a GOP size, so the H.264 encoder picks its own key frame spacing. With GOP 0, which is the default, some vendors' encoders write a single key frame at the start of the take.
The editor seeks to the key frame before its target and decodes forward. On a take with one key frame, every seek decodes from the start of the take: at a cut, on pause, or when the drift watch re-anchors. This matches the report:
This PR sets
CODECAPI_AVEncMPVGOPSizeto the frame rate, which gives one key frame per second for the screen and the camera.Measurements
The editor's seek mechanism, timed with
ffmpeg -hwaccel d3d11va -ss Ton synthetic 10-minute 1080p60 H.264 takes (RTX 4070 Ti):The helper's encoder test (new case
key-frame-interval), 4 s at 30 fps:The other 24 helper tests still pass.
Not measured
ffprobe -skip_frame nokey -show_entries frame=pts_timeon their screen file would settle it.Touches
electron/native/**, so evidence is needed. File size: one key frame per second instead of the encoder's own spacing (3 s on the Microsoft software encoder, ~1 s on NVIDIA here).Refs #1475
🤖 Generated with Claude Code
Summary by CodeRabbit