Skip to content
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

Implement wrapper for sws_getCoefficients() #174

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JonnyBurger
Copy link

@JonnyBurger JonnyBurger commented Feb 20, 2024

Added new set_colorspace_details method for Context (swscaler).

By default, you can use sws_scale, but it by default assumes the default colorspace, which I understand to be BT.601.
So if a video with a difference colorspace (BT.709 or BT.2020) is being input, then the colors shifts.

Using this function, you can control it!

For those curious, here is how I intend to use this to convert frames to RGB:

  1. Call let context = Context::get()
  2. Call context.set_colorspace_details
    1. input_space: Pass the value of video.color_space()
    2. src_range: Pass the value of video.color_range()
    3. dst_range: In my case, I want to convert it to RGB, so I want full range, therefore I pass color::Range::JPEG
    4. brightness: I set to to 0 to make no correction
    5. contrast and saturation: I set it to 1 << 16 to make no correction

I have no experience, I just read https://www.canva.dev/blog/engineering/a-journey-through-colour-space-with-ffmpeg/. If you can, please review carefully.

@JonnyBurger JonnyBurger marked this pull request as draft February 20, 2024 09:58
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.

1 participant