fix(macos): capture and tag the screen track as BT.709 studio range - #947
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit detailsLimit details: You’ve used all 8 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
|
Tested on a Mac: the pending checks pass. macOS 26.5, Apple M1, one 4K display at 2x (display profile "Evanlak4K60", not sRGB). How: release builds of this branch's helper (55ff2c0) and of its parent (baseline), each run in Tags (
Raw YUV, mean over an 80x80 px block
Reading it
Not covered: window capture (same |
Summary
The macOS helper now captures BT.709 studio-range YCbCr and tags the H.264 track BT.709, the colour the compositor decodes every recording as.
Fixes #943
Part of #920
Changes
pixelFormatis420vinstead of BGRA,colorMatrixBT.709,colorSpaceNamesRGB. Unset, the buffers carried the display's own colour space (P3 on most Macs) and VideoToolbox chose the matrix.AVVideoColorPropertiesKeywith BT.709 primaries, transfer function and YCbCr matrix. It sits in the top-level output settings, so no line of the compression dictionary that fix(macos): pin the keyframe interval to 1 s and count dropped video frames #938 edits is touched.OpenScreenCaptureCore/VideoColor.swift, with an XCTest that pins the capture matrix to the tagged one.Why 420v is safe
didOutputSampleBufferthroughretimedSampleBuffer(timing only) tovideoInput.append.isCompleteFramereads theSCStreamFrameInfoattachments only.SCStream. The picker session records through the sameScreenCaptureRecorder.420vas a supportedpixelFormat, andcolorMatrixapplies to420vand420f.captureOutputSizealready returns even dimensions, which 4:2:0 needs.queueDepth = 6, so buffer memory drops by about 2.7.Tested
swift-macos-helperCI job (swift testand the release build). Swift cannot build on the Windows machine this was written on.Pending (maintainer, on a Mac)
ffprobe -show_streams | grep color_on a take readstv / bt709 / bt709 / bt709.AVVideoColorPropertiesKey. If ScreenCaptureKit tags the sRGB buffers with an sRGB transfer function, the writer may re-encode them to the BT.709 curve, and grey then reads Y≈115. Red cannot show this; grey does. The fix would be to retag the buffer's transfer attachment beforeappend.🤖 Generated with Claude Code