Repository navigation
improve: one-second keyframes for Studio screen recordings on macOS - #4430
Draft
richiemcilroy wants to merge 4 commits into
Draft
richiemcilroy wants to merge 4 commits into
richiemcilroy wants to merge 4 commits into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was successfully deployed
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.
Draft, on hold: the size win costs editor seek latency, and that trade needs a product decision. Do not merge.
Studio screen recordings on macOS encode through
h264_videotoolboxin realtime mode, and that branch ofget_codec_and_optionsnever setsg. VideoToolbox then gets FFmpeg's default GOP of 12 frames: five keyframes a second at 60 fps, which is where most of a file's bytes go. Every other encoder, and the VideoToolbox export path (#2502), already sets a keyframe interval.This adds an opt-in keyframe interval that only realtime
h264_videotoolboxreads, and turns it on (1 s) for the in-process macOS Studio screen recording at Balanced and Compatibility quality.H264EncoderBuilder::with_realtime_videotoolbox_keyframe_interval,SegmentedVideoEncoderConfig::realtime_videotoolbox_keyframe_intervalandMacOSFragmentedM4SMuxerConfig::realtime_videotoolbox_keyframe_interval, allNoneby default.STUDIO_DISPLAY_VIDEOTOOLBOX_KEYFRAME_INTERVAL(1 s) is set bycapture_pipeline.rsfor Studio, except Ultra. With longer GOPs VideoToolbox reaches Ultra's much higher bitrate target on motion, so Ultra files would grow.verify-crashcovers it.Size and quality
Same scripted scene (static UI, text scroll, typing, a video window) recorded with the
capCLI on an M4 Mac mini, scored against lossless captures of the scene.On the encoder alone (same lossless input through
SegmentedVideoEncoder, paced in real time): Balanced 12.3 to 10.0 Mbps, Compatibility 7.2 to 5.3 Mbps. Scrolling is 2.3x smaller, typing 2.7x smaller, and video gains 1 dB at the same size. VMAF is equal, per-frame encode time is unchanged, and CPU during recording is unchanged.Seek latency (why it is on hold)
decode-benchmarkrandom access, same content:In
scrub-benchmarkon the M4, idle random seek p50 goes from 26 to 32 ms to 31 to 38 ms. A slow backward drag presents 50 to 62 frames/s instead of 91. Forward drags are unchanged.Checks
realtime_keyframe_interval_only_changes_realtime_videotoolbox: every other encoder's options are identical with or without the setting, for both recording and export.realtime_videotoolbox_keyframe_interval_keeps_two_second_segments: same segment count, 1 s keyframes.