How to Use the FFmpeg colorcontrast Filter

This guide explains how to adjust the color contrast of video files using FFmpeg's built-in colorcontrast filter. By modifying contrast across complementary color axes, you can make video colors appear more vivid and distinct or soften them for a muted, flatter look. Below, you will find the filter syntax, explanations of its key parameters, and practical command-line examples for both increasing and decreasing color contrast.

Understanding the colorcontrast Filter

The colorcontrast filter adjusts color contrast by manipulating three primary opposing color axes:

  • rc: Red-Cyan contrast adjustment.
  • gm: Green-Magenta contrast adjustment.
  • by: Blue-Yellow contrast adjustment.

Each of these parameters accepts a float value between -1.0 and 1.0, where the default value is 0.0 (no change).

  • Positive values (0.1 to 1.0): Increase contrast, pushing opposing colors further apart and making them more saturated and distinct.
  • Negative values (-0.1 to -1.0): Decrease contrast, pulling colors closer together toward neutral gray.

An optional parameter, pl (preserve lightness), accepts values from 0.0 to 1.0 (default is 0.0). Increasing this value helps keep the overall perceived luminance stable while shifting colors.


How to Increase Color Contrast

To boost contrast uniformly across the entire image, apply positive values to rc, gm, and by.

ffmpeg -i input.mp4 -vf "colorcontrast=rc=0.3:gm=0.3:by=0.3" -c:a copy output.mp4

To enhance contrast while maintaining the original brightness levels of the scene, add the pl parameter:

ffmpeg -i input.mp4 -vf "colorcontrast=rc=0.4:gm=0.4:by=0.4:pl=0.5" -c:a copy output.mp4

How to Decrease Color Contrast

To reduce contrast and give the video a flatter, more desaturated appearance, apply negative values to the color channels:

ffmpeg -i input.mp4 -vf "colorcontrast=rc=-0.3:gm=-0.3:by=-0.3" -c:a copy output.mp4

To create an extreme muted tone close to neutral tones, lower the values closer to -1.0:

ffmpeg -i input.mp4 -vf "colorcontrast=rc=-0.7:gm=-0.7:by=-0.7" -c:a copy output.mp4

Targeted Color Axis Adjustments

You can adjust individual axes independently if you only want to affect specific color relationships.

  • Enhance warmth and skies: Increase by (Blue-Yellow) while leaving other channels untouched:

    ffmpeg -i input.mp4 -vf "colorcontrast=by=0.5" -c:a copy output.mp4
  • Mute foliage and magentas: Lower gm (Green-Magenta) without altering red, cyan, blue, or yellow:

    ffmpeg -i input.mp4 -vf "colorcontrast=gm=-0.4" -c:a copy output.mp4