FFmpeg EQ Filter: Adjust Video Contrast and Brightness
This guide explains how to use the FFmpeg eq (equalizer)
filter to adjust a video’s contrast, brightness, saturation, and gamma.
You will learn the syntax of the filter, the specific parameters for
each adjustment, and practical command-line examples to enhance your
video processing workflow.
Understanding the EQ Filter Parameters
The eq filter in FFmpeg allows you to adjust video
properties on the fly. The filter uses the following key parameters:
contrast: Adjusts the difference between light and dark areas. The default value is1.0. The scale ranges from-2.0to2.0.brightness: Adjusts the overall light intensity. The default value is0.0. The scale ranges from-1.0(completely black) to1.0(completely white).saturation: Adjusts the intensity of colors. The default value is1.0. The scale ranges from0.0(grayscale) to3.0.gamma: Adjusts the non-linear luminance. The default value is1.0. The scale ranges from0.1to10.0.
Basic Command Syntax
The basic syntax for applying the eq filter uses the
-vf (video filter) flag:
ffmpeg -i input.mp4 -vf "eq=parameter=value:parameter2=value2" output.mp4You can specify one or more parameters separated by colons.
Practical Examples
1. Adjusting Contrast and Brightness
To slightly increase the contrast and brightness of a video, use the following command:
ffmpeg -i input.mp4 -vf "eq=contrast=1.2:brightness=0.05" -c:a copy output.mp4contrast=1.2increases the contrast by 20%.brightness=0.05slightly brightens the image.-c:a copycopies the audio stream without re-encoding to save time.
2. Modifying Saturation
To make a video more vibrant by increasing the color saturation:
ffmpeg -i input.mp4 -vf "eq=saturation=1.5" -c:a copy output.mp4To convert a video to grayscale, set the saturation to
0:
ffmpeg -i input.mp4 -vf "eq=saturation=0" -c:a copy output.mp43. Adjusting Gamma
Gamma correction helps in fixing videos that are too dark or washed out without clipping the highlights or shadows. To lower the gamma (making midtones brighter):
ffmpeg -i input.mp4 -vf "eq=gamma=1.5" -c:a copy output.mp4To increase the gamma (making midtones darker):
ffmpeg -i input.mp4 -vf "eq=gamma=0.8" -c:a copy output.mp44. Combining All Adjustments
You can combine all four parameters into a single command to achieve the precise look you desire:
ffmpeg -i input.mp4 -vf "eq=contrast=1.1:brightness=0.02:saturation=1.2:gamma=0.9" -c:a copy output.mp4This command increases the contrast by 10%, adds a touch of brightness, boosts the color saturation by 20%, and slightly darkens the midtones using gamma.