FFmpeg Colorchannelmixer High Contrast Black and White

This article explains how to use the FFmpeg colorchannelmixer filter to convert color video into high-contrast black and white. You will learn how the filter operates, how to configure its parameters to achieve a monochrome effect, and how to manipulate individual color channels to create a dramatic, high-contrast aesthetic.

Understanding the Colorchannelmixer Filter

The colorchannelmixer filter allows you to adjust the contribution of the input Red (R), Green (G), and Blue (B) channels to the output Red, Green, and Blue channels.

For an output image to be grayscale, the Red, Green, and Blue output channels must receive the exact same mix of input colors. This is represented by setting the coefficients for the output channels (rr, rg, rb for Red; gr, gg, gb for Green; and br, bg, bb for Blue) to identical values.

The naming convention for the parameters is: * rr / rg / rb: Amount of input Red, Green, and Blue in the output Red channel. * gr / gg / gb: Amount of input Red, Green, and Blue in the output Green channel. * br / bg / bb: Amount of input Red, Green, and Blue in the output Blue channel.

Creating High Contrast Black and White

Standard grayscale conversion distributes channel weights evenly or according to natural human eye perception (typically 30% Red, 59% Green, and 11% Blue).

To achieve a high-contrast look, you must alter these ratios. By heavily favoring one channel (such as Red) while subtracting or ignoring other channels (like Blue), you mimic physical lens filters used in classic black-and-white photography.

Method 1: The Red Filter Effect (Dramatic Contrast)

A red filter darkens blue skies and green foliage while brightening red elements (like skin tones). This creates a stark, dramatic contrast.

To achieve this, set the Red input contribution high and reduce or eliminate the Green and Blue inputs:

ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.0:rg=0.0:rb=-0.2:gr=1.0:gg=0.0:gb=-0.2:br=1.0:bg=0.0:bb=-0.2" -c:a copy output.mp4

In this command: * rr=1.0:rg=0.0:rb=-0.2 defines the output Red channel. It uses 100% of the input Red, 0% Green, and subtracts 20% of the input Blue to crush the shadow areas. * gr=1.0:gg=0.0:gb=-0.2 applies the identical mix to the output Green channel. * br=1.0:bg=0.0:bb=-0.2 applies the identical mix to the output Blue channel.

Method 2: High-Contrast Pancromatic Blend

If you want a more balanced but still highly stylized high-contrast look, you can boost the overall sum of the channels slightly above 1.0 to blow out highlights, while using negative values to deepen the blacks.

ffmpeg -i input.mp4 -vf "colorchannelmixer=rr=1.2:rg=0.2:rb=-0.4:gr=1.2:gg=0.2:gb=-0.4:br=1.2:bg=0.2:bb=-0.4" -c:a copy output.mp4

In this variation: * The sum of the positive coefficients is 1.4 (1.2 + 0.2), which brightens the highlights. * The negative blue coefficient (-0.4) aggressively darkens blue tones, expanding the dynamic range between light and dark areas.

Fine-Tuning Your Output

You can customize the formula to fit your specific footage: * To brighten skin tones: Increase the Red (rr, gr, br) values. * To darken skies: Decrease the Blue (rb, gb, bb) values into negative numbers. * To adjust overall brightness: Ensure the sum of the three active variables (e.g., rr + rg + rb) equals roughly 1.0 for neutral exposure, above 1.0 for a brighter/blown-out look, or below 1.0 for a darker, moodier look.