What is the mpv deband filter and how to use it?

The deband filter in the mpv media player is a powerful video processing tool designed to eliminate color banding artifacts, which appear as distinct, unnatural steps or “stripes” in smooth color gradients. This article explains what causes color banding, how mpv’s deband filter seamlessly smooths out these visual imperfections, and provides the exact configuration commands needed to enable and fine-tune the filter for an optimal viewing experience.

Understanding Color Banding

Color banding occurs when a video file lacks sufficient color depth (bit depth) to display a smooth transition between shades of a similar color, such as a sunset, a clear sky, or a dark, foggy scene. Instead of a seamless gradient, you see noticeable bands of color.

While this artifact is highly common in heavily compressed 8-bit videos, it can also happen during video decoding or rendering. The deband filter analyzes neighboring pixels and introduces subtle, imperceptible noise (dithering) to blend these harsh edges away, restoring the appearance of a smooth gradient.

How to Enable Debanding in mpv

You can enable the deband filter in mpv either temporarily during playback using a keyboard shortcut, or permanently by modifying your configuration file.

Temporary Activation (Keyboard Shortcut)

To toggle the deband filter on and off while a video is actively playing, press the h key on your keyboard.

Note: If you have custom keybindings configured in your input.conf file, this default shortcut may differ. You can explicitly map it by adding h cycle deband to your input.conf file.

Permanent Activation (Configuration File)

To ensure the deband filter is always active whenever you open mpv, you need to add the command to your mpv.conf file.

  1. Locate your mpv.conf file (typically found in %APPDATA%/mpv/ on Windows or ~/.config/mpv/ on Linux/macOS).
  2. Open the file in a text editor.
  3. Add the following line on its own new line:
deband=yes
  1. Save and close the file.

Advanced Deband Configuration

For users who want to balance video quality and hardware performance, mpv allows you to customize the intensity and behavior of the deband filter. Below are the primary sub-options you can add to your mpv.conf to fine-tune the process:

An example of a high-quality, optimized debanding setup in mpv.conf looks like this:

deband=yes
deband-iterations=4
deband-threshold=48
deband-range=16
deband-grain=48