How to Use FFmpeg eq Filter to Adjust Color

This guide explains how to use the eq (equalizer) video filter in FFmpeg to adjust essential image parameters such as brightness, contrast, saturation, and gamma. You will learn the syntax of the filter, the specific parameters available for color correction, and practical command-line examples to help you enhance or correct the visual quality of your videos.

Understanding the eq Filter Parameters

The eq filter in FFmpeg allows you to manipulate the color properties of a video on a frame-by-frame basis. The filter accepts several parameters, each controlling a specific aspect of the image:

Basic Command Syntax

To use the eq filter, apply the -vf (video filter) flag followed by eq= and your chosen parameters separated by colons.

The basic command structure is:

ffmpeg -i input.mp4 -vf "eq=parameter1=value1:parameter2=value2" output.mp4

Practical Examples

1. Adjusting Brightness and Contrast

To make a video slightly brighter and increase its contrast, use the following command. This increases the brightness by 0.1 and the contrast to 1.2:

ffmpeg -i input.mp4 -vf "eq=brightness=0.1:contrast=1.2" output.mp4

To darken a video and lower the contrast, use negative values for brightness and values less than 1.0 for contrast:

ffmpeg -i input.mp4 -vf "eq=brightness=-0.1:contrast=0.8" -c:a copy output.mp4

2. Adjusting Color Saturation

If your video colors look dull, you can boost the saturation. To increase saturation by 50% (setting it to 1.5):

ffmpeg -i input.mp4 -vf "eq=saturation=1.5" output.mp4

To create a grayscale (black and white) video, set the saturation to 0:

ffmpeg -i input.mp4 -vf "eq=saturation=0" output.mp4

3. Modifying Gamma Levels

Gamma adjustment changes the mid-tones of an image without severely impacting the highlights and shadows. To make mid-tones brighter, decrease the gamma value below 1.0 (e.g., 0.8). To make mid-tones darker, increase the gamma value above 1.0 (e.g., 1.5):

ffmpeg -i input.mp4 -vf "eq=gamma=0.8" output.mp4

4. Color Channel Correction

You can target individual color channels using gamma_r, gamma_g, and gamma_b to fix color casts. For example, to reduce a strong green tint, you can increase the green gamma value (values above 1.0 darken the channel):

ffmpeg -i input.mp4 -vf "eq=gamma_g=1.2" output.mp4

5. Combining Multiple Adjustments

You can combine all of these parameters into a single filter chain to completely grade your video. The following command increases contrast, reduces brightness, boosts saturation, and tweaks the overall gamma:

ffmpeg -i input.mp4 -vf "eq=contrast=1.1:brightness=-0.05:saturation=1.3:gamma=0.9" -c:a copy output.mp4

Note: The -c:a copy argument is included in these commands to copy the audio stream without re-encoding it, which saves processing time.