Repository navigation
Decode V4L2 cameras with the YCbCr encoding they report - #25
Merged
Merged
Conversation
Qt Multimedia's V4L2 camera maps V4L2_COLORSPACE_SRGB to BT.601 and never reads ycbcr_enc. Capture cards such as the Elgato Cam Link 4K report sRGB with an explicit BT.709 encoding, so Monologue decoded them with the wrong matrix: colors came out muted compared to browsers and other apps. Ask the device for its encoding on the first frame and, when Qt guessed BT.601 but the driver says otherwise, retag frames with the correct color space. Preview and recordings both use the corrected frames. Cameras that really deliver BT.601 (like most MJPEG webcams) are untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryThe PR reads the camera’s reported YCbCr encoding and corrects frames that Qt marked as BT.601.
The earlier timestamp finding is fixed:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master's writer now converts frames to 4:2:0; its plain copy for other formats uses media::withFormat from this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Qt Multimedia's V4L2 camera only reads the
colorspacefield and mapsV4L2_COLORSPACE_SRGBto BT.601 (the source even carries a##### is this correct???comment). It never looks atycbcr_enc. The Elgato Cam Link 4K reports sRGB with an explicit BT.709 encoding, so Monologue decoded it with the BT.601 matrix and colors came out muted next to Zoom/Chromium, which honor the encoding.On the first frame, Monologue now asks the device (
VIDIOC_G_FMT) for its YCbCr encoding. When Qt guessed BT.601 but the driver says BT.709/BT.2020, frames are retagged with the right color space, so both preview and recordings decode correctly. Devices that really are BT.601 (e.g. the Logi 4K Pro's MJPEG) are untouched.The frame-wrapping buffer used by the writer moved into
mediautilswith a format override, so both places share it. When the writer converts packed 4:2:2 to 4:2:0 for the encoder (#32), it keeps the corrected label, so a Cam Link recording is tagged BT.709. A test records relabelled YUYV frames and checks the file with ffprobe.🤖 Generated with Claude Code