Skip to content

video/image_writer: tag bits_per_raw_sample when pixfmt changes #16161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Traneptora
Copy link
Member

This populates the AVCodecContext->bits_per_raw_sample field value when the pixel format of the screenshot being written doesn't match the pixel format of the original video. For example, if the original video was 10-bit and the screenshot is 16-bit, it populates this field so the encoder can make use of it.

Currently libjxl and png encoders are known to accept this tag and set the corresponding metadata (via BitDepthHeader, or sBIT).

This feature is only enabled if screenshot-sw=yes is enabled, because screenshots from a hardware buffer are always natively at max-depth.

Note: Duplicate of #11247 which was closed because of branch delete shenanigans I renamed the branch and this is a new PR after the comments in that one.

Copy link

github-actions bot commented Mar 31, 2025

@Traneptora Traneptora force-pushed the screenshot-bits-per-raw-sample branch 3 times, most recently from bfa2002 to 419f50a Compare April 8, 2025 19:32
Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This populates the AVCodecContext->bits_per_raw_sample field value
when the pixel format of the screenshot being written doesn't match the
pixel format of the original video. For example, if the original video
was 10-bit and the screenshot is 16-bit, it populates this field so the
encoder can make use of it.

Currently libjxl and png encoders are known to accept this tag and set
the corresponding metadata (via BitDepthHeader, or sBIT).

This feature is only enabled if screenshot-sw=yes is enabled, because
screenshots from a hardware buffer are always natively at max-depth.

Signed-off-by: Leo Izen <[email protected]>
@Traneptora Traneptora force-pushed the screenshot-bits-per-raw-sample branch from 419f50a to b858488 Compare April 21, 2025 18:22
Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants