Adjust Brightness and Contrast using FFmpeg

FFmpeg is a powerful tool for manipulating audio and video files. One of the common tasks that you may want to perform with FFmpeg is to adjusting brightness and contrast of a video or image using FFmpeg. It is quite easy to do this as FFmpeg contains all the necessary tools to decode a video/image, process it, and convert it back to the appropriate image/video format.

In this blog post, we will explain the concept of brightness, contrast, and show you how to control the brightness and contrast of an image or video using FFmpeg.

Let’s go.

Initial Setup: Installing FFmpeg

Prior to delving into file conversions, the first step is to ensure that you have FFmpeg installed on your machine. The official FFmpeg repository (FFmpeg Downloads) houses the latest version and you can pick up a static build from there for your operating system. However, OS-specific package managers are also available for obtaining the latest FFmpeg.

  • Windows:
    Utilize Chocolatey with: choco install ffmpeg
  • Linux:
    Deploy apt-get via: sudo apt-get install ffmpeg
  • Mac OS X:
    With Homebrew, simply execute: brew install ffmpeg

Following the installation, access the terminal or command prompt and traverse to the directory containing your target files. For more examples and options for installing FFmpeg, go here.

After you’ve installed FFmpeg, you are ready to adjust brightness and contrast of your files using FFmpeg. Let’s learn how!

Understanding Brightness and Contrast

Brightness and contrast are fundamental attributes of an image or video that greatly influence its visual appeal. Let’s briefly define these concepts before we jump into the FFmpeg commands to manipulate them:

  • Brightness: Refers to the overall luminance or lightness of an image or video. Increasing brightness makes the content appear lighter, while decreasing it makes it darker.
  • Contrast: Represents the difference in brightness between various parts of an image or video. Higher contrast results in more pronounced differences between light and dark areas, enhancing the visual impact.

Now, let’s proceed with practical examples of how to adjust these parameters using FFmpeg

How to Adjust Brightness and Contrast using FFmpeg

The brightness and contrast of a video are controlled by two parameters: luma and chroma. Luma is the measure of the intensity of light in a pixel, while chroma is the measure of the colorfulness of a pixel. Luma and chroma are also known as Y and C respectively in the YUV color space, which is widely used for video encoding and processing.

To adjust the brightness and contrast of a video using FFmpeg, we need to use the eq filter, which applies an equation to each pixel of the input video. The eq filter has several options, but the ones we are interested in are:

  • brightness: This option sets the luma offset, which shifts the luma values by a constant amount. The range is -1 to 1, with 0 being the default value. A positive value increases the brightness, while a negative value decreases it.
  • contrast: This option sets the luma gain, which scales the luma values by a constant factor. The range is 0 to 2, with 1 being the default value. A value greater than 1 increases the contrast, while a value less than 1 decreases it.

The syntax for using the eq filter is:

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

where input.mp4 is the name of the input video file, output.mp4 is the name of the output video file, and value is the numerical value for the brightness or contrast option.

For example, if we want to increase the brightness by 0.2 and decrease the contrast by 0.8, we can use the following command:

ffmpeg -i input.mp4 -vf "eq=brightness=0.2:contrast=0.8" output.mp4

The result will be a video that looks more washed out and less sharp than the original.

On the other hand, if we want to decrease the brightness by 0.1 and increase the contrast by 1.2, we can use the following command:

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

The result will be a video that looks darker and more vivid than the original.

Adjusting Contrast with FFmpeg

Manipulating contrast in FFmpeg is also achieved through the eq filter, but you’ll focus on the contrast parameter. The basic syntax is as follows:

ffmpeg -i input.mp4 -vf eq=contrast=value output.mp4

As with brightness, you’ll replace input.mp4 with your input video file and output.mp4 with the desired output file name. The value parameter controls the contrast level, where values greater than 1 increase contrast, and values less than 1 decrease it.

Increasing Contrast

To boost the contrast of a video, specify a value greater than 1, like this:

ffmpeg -i input.mp4 -vf eq=contrast=1.3 output.mp4

In this example, the contrast is increased by 30% (1.3 times the original).

Decreasing Contrast

To decrease the contrast, use a value less than 1:

ffmpeg -i input.mp4 -vf eq=contrast=0.8 output.mp4

Here, the contrast is reduced to 80% of the original.

Combining Brightness and Contrast Adjustments

What if you want to simultaneously adjust both brightness and contrast? FFmpeg allows you to chain multiple filters together using a comma. Here’s an example that increases brightness and contrast:

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

In this command, brightness is increased by 20% (1.2 times) and contrast by 50% (1.5 times).

Applying Filters to Specific Segments

Sometimes, you may only want to apply these adjustments to specific segments of a video. FFmpeg provides the enable filter to control when the adjustments take effect. Here’s an example:

ffmpeg -i input.mp4 -vf "eq=brightness=1.2:contrast=1.5,enable='between(t,10,30)'" output.mp4

In this command, the brightness and contrast adjustments are applied only between the 10th and 30th second of the video.


With FFmpeg’s powerful filtering capabilities, you can easily adjust brightness and contrast in your videos. If you are interested in FFmpeg, check out comprehensive FFmpeg tutorials with commandline examples and explanations.

Thank you!

krishna rao vijayanagar
Krishna Rao Vijayanagar

Krishna Rao Vijayanagar, Ph.D., is the Editor-in-Chief of OTTVerse, a news portal covering tech and business news in the OTT industry.

With extensive experience in video encoding, streaming, analytics, monetization, end-to-end streaming, and more, Krishna has held multiple leadership roles in R&D, Engineering, and Product at companies such as Harmonic Inc., MediaMelon, and Airtel Digital. Krishna has published numerous articles and research papers and speaks at industry events to share his insights and perspectives on the fundamentals and the future of OTT streaming.

Leave a Comment

Your email address will not be published. Required fields are marked *

Enjoying this article? Subscribe to OTTVerse and receive exclusive news and information from the OTT Industry.