rust-ffmpeg
rust-ffmpeg copied to clipboard
Implement wrapper for sws_getCoefficients()
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 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 correction -
contrastandsaturation: I set it to1 << 16to 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.