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:
- contrast: Sets the contrast expression. The value
must be a float between
-2.0and2.0. The default is1.0. - brightness: Sets the brightness expression. The
value must be a float between
-1.0and1.0. The default is0.0. - saturation: Sets the saturation expression. The
value must be a float between
0.0and3.0. The default is1.0. - gamma: Sets the gamma expression. The value must be
a float between
0.1and10.0. The default is1.0. - gamma_r / gamma_g / gamma_b: Adjusts the gamma for
the red, green, and blue channels individually. The default is
1.0. - gamma_weight: Sets the gamma weight, which reduces
the effect of gamma on darker colors. The value must be a float between
0.0and1.0. The default is1.0.
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.mp4Practical 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.mp4To 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.mp42. 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.mp4To create a grayscale (black and white) video, set the saturation to
0:
ffmpeg -i input.mp4 -vf "eq=saturation=0" output.mp43. 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.mp44. 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.mp45. 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.mp4Note: The -c:a copy argument is included in these
commands to copy the audio stream without re-encoding it, which saves
processing time.