[FFmpeg-user] colorchannelmixer: perceptual gamma

Paul B Mahol onemda at gmail.com
Sat Jan 23 23:33:40 EET 2021


On Sat, Jan 23, 2021 at 6:32 PM Simon Taylor <simon.taylor.uk at gmail.com>
wrote:

> Question: Is there a way to make ffmpeg's colorchannelmixer use perceptual
> gamma?
>

Added pl option to colorchannelmixer. It is designed to preserve overall
rgb lightness.
Its behavior is similar but not exact with gimp. So with your input using
also pl=1 option
will remove blue tint.
You need latest ffmpeg build with that commit included.


>
> Background: I'm trying to salvage source H.264 video from a capture device
> (8mm film scanner) which seems to have an extreme saturation issue that
> often leaves the red and green channels saturated with minimal blue,
> leaving a bright yellow stain on that area of the frame.
> https://i.imgur.com/6Qh6PRk.png
>
> Editing a single frame capture of the video in GIMP, I see that if I use
> the Colours -> Components -> Channel Mixer tool and supplement the blue
> channel (1.0) with the green channel (1.0) https://i.imgur.com/Q0qqgSP.png
> the result is desaturated but usable https://i.imgur.com/t19QU4U.png
>
> I've attempted to replicate this using ffmpeg's colorchannelmixer with the
> same values (output blue = 1.0*blue + 1.0*green)
>
> Code: https://pastebin.com/raw/czS76ZrN
>
> but the result has a blue tint. https://i.imgur.com/TsnBKb2.png
>
> Looking at the RGB values, ffmpeg's behaviour is technically correct (the
> processed B channel is an exact sum of the source B and G channels), but
> GIMP's behaviour is what I need.
>
> GIMP's behaviour is described in
>
> https://graphicdesign.stackexchange.com/questions/136750/gimp-channel-mixer-does-not-work-as-expected
> and gamma correction is suggested as the likely difference in how GIMP
> reaches its result.
>
> Thanks,
>
> Simon
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list