Configure FFmpeg Removegrain Individual Plane Modes

This guide explains how to configure individual plane modes using the removegrain filter in FFmpeg. By targeting specific video planes (luma and chroma) with different mode values, you can customize your spatial denoising process for optimal video quality and performance.

The removegrain filter in FFmpeg accepts up to four parameters to control the denoising mode of each individual video plane:

Each mode is represented by an integer from 0 to 24. A value of 0 bypasses the filter, leaving that specific plane completely untouched. Modes 1 through 24 apply various spatial denoising algorithms of varying strengths.

Syntax Structure

You can define these modes using named parameters or positional parameters inside your filtergraph.

Named Parameters:

ffmpeg -i input.mp4 -vf removegrain=m0=4:m1=2:m2=2 output.mp4

Positional Parameters:

ffmpeg -i input.mp4 -vf removegrain=4:2:2 output.mp4

(Note: If a plane’s mode is omitted in positional syntax, it defaults to the value of the previous specified plane. If the first mode m0 is omitted, it defaults to 0.)

Configuration Examples

Here are common scenarios for configuring individual planes:

1. Denoise Only the Luma Plane

To denoise only the luma (brightness) plane and leave the chroma (color) planes untouched, set m0 to your desired mode and m1 and m2 to 0:

ffmpeg -i input.mp4 -vf removegrain=m0=2:m1=0:m2=0 output.mp4

2. Denoise Only the Chroma Planes

If your video has color noise but the brightness channel is clean, bypass the luma plane and apply denoising to the chroma planes:

ffmpeg -i input.mp4 -vf removegrain=m0=0:m1=4:m2=4 output.mp4

3. Apply Different Strengths to Luma and Chroma

For a balanced approach, you can apply a stronger filter to the luma plane and a lighter filter to the chroma planes:

ffmpeg -i input.mp4 -vf removegrain=m0=20:m1=2:m2=2 output.mp4