How to Fix Green Color Cast in Video with FFmpeg

Correcting off-color footage is a common post-production task, and FFmpeg provides a powerful tool to achieve this programmatically. This article explains how to remove an unwanted green color cast from your video files using FFmpeg’s colorbalance filter. You will learn the syntax of the filter, how to target specific tonal ranges, and see a practical command-line example to restore natural colors to your footage.

Understanding the Colorbalance Filter

The colorbalance filter in FFmpeg allows you to adjust the levels of Red, Green, and Blue (RGB) across three distinct tonal ranges: Shadows (s), Midtones (m), and Highlights (h).

The basic parameters are named using a two-letter system: * First letter (Color): r (Red), g (Green), b (Blue) * Second letter (Tonal Range): s (Shadows), m (Midtones), h (Highlights)

Each parameter accepts a value between -1.0 (minimum) and 1.0 (maximum), with 0.0 being no change.

To neutralize a green color cast, you must decrease the green levels, increase the magenta levels (by boosting red and blue), or apply a combination of both.

The Command to Fix Green Cast

To remove a green cast, you will typically want to lower the green midtones (gm) and highlights (gh), as these areas are where color casts are most visible. You can also slightly boost red and blue to introduce magenta, the complementary color of green.

Here is the standard command-line template:

ffmpeg -i input.mp4 -vf "colorbalance=gm=-0.15:bm=0.05:rm=0.05" -c:a copy output.mp4

Parameter Breakdown

Fine-Tuning the Correction

If the green cast persists in the dark or bright areas of your video, you can expand the filter parameters to target shadows and highlights:

ffmpeg -i input.mp4 -vf "colorbalance=gs=-0.05:gm=-0.15:gh=-0.1" -c:a copy output.mp4

In this adjusted command: * gs=-0.05 gently reduces green in the shadows (dark areas). * gh=-0.1 reduces green in the highlights (bright areas, like skies or bright walls).

Adjust these decimal values in small increments (e.g., steps of 0.05) until the colors in your output video look natural.