Adjust RGB Shadows Midtones Highlights in FFmpeg

This article provides a quick and practical guide on how to use the FFmpeg colorbalance filter to adjust the shadows, midtones, and highlights of the red, green, and blue channels independently. You will learn the exact syntax, the meaning of each parameter, and how to apply these color grading adjustments to your video files via the command line.

The FFmpeg colorbalance filter adjusts the color balance of an input video by modifying the intensity of the red, green, and blue (RGB) channels across three distinct tonal ranges: shadows, midtones, and highlights.

The Filter Parameters

The filter uses specific two-letter codes to target each channel and tonal range. The syntax is structured as follows:

Value Ranges and Behavior

Each parameter accepts a float value between -1.0 and 1.0. * 0.0 represents no change (the default). * Positive values shift the balance toward the chosen color (Red, Green, or Blue). * Negative values shift the balance toward the complementary color (Cyan, Magenta, or Yellow). For example, decreasing red (-1.0) increases cyan.

Command Example

To apply these adjustments, use the -vf (video filter) flag in your FFmpeg command. Below is an example that warms up the highlights (increases red and yellow/decreases blue) and cools down the shadows (increases blue):

ffmpeg -i input.mp4 -vf "colorbalance=rh=0.3:bh=-0.2:bs=0.4" -c:a copy output.mp4

In this command: * rh=0.3 increases the red color in the highlights. * bh=-0.2 decreases the blue color in the highlights (adding a yellow tint). * bs=0.4 increases the blue color in the shadows. * -c:a copy copies the audio stream without re-encoding to save processing time.