[FFmpeg-user] colorchannelmixer: perceptual gamma

Simon Taylor simon.taylor.uk at gmail.com
Sat Jan 23 19:24:50 EET 2021

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

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.

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
and gamma correction is suggested as the likely difference in how GIMP
reaches its result.



More information about the ffmpeg-user mailing list