Adjust RGB Channels in FFmpeg with colorchannelmixer
This article explains how to adjust individual red, green, and blue
(RGB) color channel gains in a video using FFmpeg’s
colorchannelmixer filter. You will learn the syntax of the
filter, how its parameters correspond to color channels, and how to
apply practical commands to color-correct or tint your video.
Understanding the colorchannelmixer Filter
The colorchannelmixer filter modifies the color channels
of a video by mixing contribution levels from each input channel (Red,
Green, Blue, and Alpha) to produce the output channels.
The filter uses a naming convention where the first letter represents the output channel and the second letter represents the input channel:
rr/rg/rb: Red output channel.rrcontrols how much of the input red channel goes into the output red channel (Red Gain).gr/gg/gb: Green output channel.ggcontrols how much of the input green channel goes into the output green channel (Green Gain).br/bg/bb: Blue output channel.bbcontrols how much of the input blue channel goes into the output blue channel (Blue Gain).
By default, all diagonal parameters (rr,
gg, bb, aa) are set to
1.0, and all cross-channel parameters (like
rg, gb, etc.) are set to 0.0.
To adjust the individual gains of the red, green, and blue channels
without mixing them together, you only need to modify
rr, gg, and
bb.
Basic Command Syntax
To adjust RGB gains, use the following template:
ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=RED_GAIN:gg=GREEN_GAIN:bb=BLUE_GAIN" -c:a copy output.mp4- Values > 1.0: Boost the intensity of the channel.
- Values < 1.0: Reduce the intensity of the channel.
- Value = 1.0: Keeps the channel at its original level.
Practical Examples
1. Boost the Red Channel (Warm Tint)
To make your video warmer by boosting the red channel by 30% and leaving the green and blue channels unchanged:
ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.3:gg=1.0:bb=1.0" -c:a copy output.mp42. Reduce the Blue Channel (Reduce Blue Light)
To decrease the blue channel output by 20% while keeping red and green at their default values:
ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.0:gg=1.0:bb=0.8" -c:a copy output.mp43. Adjust All Three Channels Simultaneously
If your video has a green color cast, you can neutralize it by lowering the green gain and slightly boosting the red and blue gains:
ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.1:gg=0.85:bb=1.1" -c:a copy output.mp44. Create a Monochromatic Red Video
If you want to completely mute the green and blue channels and only output the red channel:
ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.0:gg=0.0:bb=0.0" -c:a copy output.mp4