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:

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

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.mp4

2. 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.mp4

3. 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.mp4

4. 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