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:
Call let context = Context::get()
Call context.set_colorspace_details
input_space: Pass the value of video.color_space()
src_range: Pass the value of video.color_range()
dst_range: In my case, I want to convert it to RGB, so I want full range, therefore I pass color::Range::JPEG
brightness: I set to to 0 to make no correction
contrast and saturation: I set it to 1 << 16 to make no correction
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:
let context = Context::get()
context.set_colorspace_details
input_space
: Pass the value ofvideo.color_space()
src_range
: Pass the value ofvideo.color_range()
dst_range
: In my case, I want to convert it to RGB, so I want full range, therefore I passcolor::Range::JPEG
brightness
: I set to to 0 to make no correctioncontrast
andsaturation
: I set it to1 << 16
to make no correctionI 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.