Video color grading and filtering are essential steps in post-production, allowing for aesthetic adjustments, creative control, and enhancing visual appeal. FFmpeg, a powerful multimedia framework, provides a wide range of tools to apply color grading and filters to videos.

Basic Color Adjustments

FFmpeg allows you to perform basic color adjustments, such as changing the contrast, brightness, and saturation. These adjustments are often used as a starting point for color grading.

Adjusting Brightness and Contrast

You can use the eq (equalizer) filter to adjust the brightness and contrast of a video.

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

Explanation:

  • brightness=0.05: Increases the brightness by 5%.
  • contrast=1.2: Increases the contrast by 20%.
FFmpeg Console Output Showing Basic Brightness and Contrast Adjustment

This command applies basic adjustments to improve the visibility and clarity of the video.

Adjusting Saturation

The eq filter also allows for adjusting the saturation of a video.

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

Explanation:

  • saturation=1.5: Increases the saturation by 50%, making the colors more vivid.
FFmpeg Console Output Showing Saturation Adjustment
Banner

Using the Color Balance Filter

FFmpeg also provides the colorbalance filter, which is useful for adjusting the color balance of the shadows, midtones, and highlights.

code
ffmpeg -i input.mp4 -vf "colorbalance=rs=0.3:gs=-0.2:bs=0.1" output.mp4

Explanation:

  • rs=0.3: Adjusts the red shadows.
  • gs=-0.2: Adjusts the green midtones.
  • bs=0.1: Adjusts the blue highlights.
FFmpeg Console Output Demonstrating Color Balance Filter Application

These parameters allow for detailed adjustments to the video"s color balance across different tonal ranges.

Adjusting Gamma

Gamma correction is used to adjust the brightness of the midtones in an image or video without affecting the shadows and highlights too much. You can adjust the gamma using FFmpeg"s eq filter as well.

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

Explanation:

  • gamma=1.2: Increases the gamma, brightening the midtones.
FFmpeg Console Output Showing Gamma Correction to Brighten Midtones

Gamma adjustments are important for videos that require proper exposure or are intended for viewing on different devices.

Sharpening Video

Sharpness is an important aspect of color grading as it enhances the fine details in a video. FFmpeg offers an unsharp filter for sharpening the video.

code
ffmpeg -i input.mp4 -vf "unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=1.5" output.mp4

Explanation:

  • luma_msize_x=7:luma_msize_y=7: Specifies the size of the sharpening matrix.
  • luma_amount=1.5: Sets the amount of sharpening applied to the luma channel (brightness).
FFmpeg Console Output Displaying Video Sharpening Process

This command enhances the sharpness of the video, making edges and fine details more pronounced.

Vignette Effect for Video

A vignette effect can be applied to create a focus on the center of the frame by darkening the edges. This is useful for emphasizing the subject in a scene.

code
ffmpeg -i input.mp4 -vf "vignette" output.mp4
FFmpeg Console Output Showing Vignette Filter Application on Video

The vignette filter applies a gradual darkening around the edges of the frame, leading the viewer"s attention to the center of the video.

Color Space Conversion

In some cases, you may need to convert the video from one color space to another, such as from RGB to YUV. This is often necessary when preparing content for various devices or broadcasts.

code
ffmpeg -i input.mp4 -vf "format=yuv420p" output.mp4

Explanation:

  • format=yuv420p: Converts the video to the YUV color space with 4:2:0 chroma subsampling, which is widely used in video compression.
FFmpeg Command and Console Output Showing Color Space Conversion to YUV420p

Combining Multiple Filters

You can combine multiple filters in FFmpeg to achieve complex color grading effects in one pass. For example, applying both contrast and saturation adjustments:

code
ffmpeg -i input.mp4 -vf "eq=contrast=1.2:saturation=1.5" output.mp4
FFmpeg Console Output Showing Combined Contrast and Saturation Adjustment

This command simultaneously adjusts both the contrast and saturation, enhancing the color and visual appeal of the video.

Batch Processing Color Grading for Multiple Files

If you have a large number of videos to apply the same color grading to, you can automate the process using a script. Here"s an example of a bash script that processes all MP4 files in a directory:

code
#!/bin/bash for video in /path/to/videos/*.mp4; do ffmpeg -i "$video" -vf "eq=contrast=1.2:saturation=1.5" "${video%.mp4}_graded.mp4"done

Explanation:

  • The script loops through each MP4 video in the specified directory and applies the same color grading filter to save the output with a new filename.

What"s Next?

Looking to build automated pipelines for consistent color grading across thousands of video assets? Use Cincopa"s API to integrate FFmpeg-based filters with cloud-based batch workflows. Trigger predefined presets for contrast, saturation, gamma, and sharpness enhancement, then automatically convert to delivery-ready formats like HLS or MP4. Streamline post-production by applying uniform grading rules to large video libraries without manual configuration or local processing.