Remove Color Banding in Video Using FFmpeg Deband

Color banding, or posterization, occurs when smooth gradients in a video are broken into distinct, unnatural steps of color due to low bit depth or aggressive compression. FFmpeg includes a native deband video filter that detects and smooths these harsh transitions while attempting to preserve sharp edges and scene details. This guide covers how to implement the deband filter, how to configure its primary parameters, and practical commands to eliminate banding artifacts effectively.


Basic Syntax

To apply the deband filter with its default settings, use the -vf (video filter) flag:

ffmpeg -i input.mp4 -vf deband -c:a copy output.mp4

This runs the filter across all video planes with default values: a detection range of 16 pixels, a detection threshold of 0.02, and blurring enabled.


Core Parameters

The deband filter accepts several parameters that let you balance artifact removal against the retention of fine detail.

  • 1threshold, 2threshold, 3threshold, 4threshold (or 1t, 2t, 3t, 4t)
    • Function: Controls the threshold for detecting banding in planes 1 to 4 (Luma, Chroma U, Chroma V, Alpha).
    • Range: 0.00003 to 0.5 (Default: 0.02).
    • Behavior: Higher values remove stronger, more noticeable banding lines, but setting this too high will blur fine textures like skin, fabric, or subtle film grain.
  • range (or r)
    • Function: The maximum distance in pixels to sample adjacent pixels for gradient estimation.
    • Range: 8 to 128 (Default: 16).
    • Behavior: Larger values smooth out wider bands (often found in large skies or foggy scenes) at the cost of processing speed.
  • blur (or b)
    • Function: Determines whether the target pixel is compared to the average of neighboring pixels (true) or a single neighbor (false).
    • Default: true.
    • Behavior: Leaving this set to true produces smoother, more natural-looking results.
  • coupling (or c)
    • Function: When enabled, compares all color components together rather than processing each color plane independently.
    • Default: false.

1. Moderate Debanding for Typical Web Video

For standard banding caused by 8-bit encoding or moderate compression:

ffmpeg -i input.mp4 -vf "deband=1t=0.03:2t=0.03:3t=0.03:range=16" -c:v libx264 -crf 18 -c:a copy output.mp4

2. Strong Debanding for Wide, Flat Gradients

For scenes with large, visible steps across wide areas (such as clear skies or underwater shots), increase both the range and threshold:

ffmpeg -i input.mp4 -vf "deband=1t=0.05:2t=0.05:3t=0.05:range=24:blur=true" -c:v libx264 -crf 18 -c:a copy output.mp4

3. Plane-Specific Debanding

If color channels (Chroma) show more artifacting than brightness (Luma), increase the chroma thresholds independently:

ffmpeg -i input.mp4 -vf "deband=1t=0.015:2t=0.04:3t=0.04:range=16" -c:v libx264 -crf 18 -c:a copy output.mp4

Preventing Banding from Returning

Applying the filter removes banding during decoding, but re-encoding into an 8-bit format at low bitrates can reintroduce the same artifacts. To prevent this:

  1. Encode to 10-bit color: Even if the source is 8-bit, 10-bit encoding significantly reduces the mathematical chance of rounding errors that cause banding.

    ffmpeg -i input.mp4 -vf "deband" -c:v libx264 -pix_fmt yuv420p10le -crf 18 -c:a copy output.mp4
  2. Use a lower CRF / higher bitrate: Ensure the encoder has sufficient data budget to retain the newly smoothed gradients.