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.conffile, this default shortcut may differ. You can explicitly map it by addingh cycle debandto yourinput.conffile.
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.
- Locate your
mpv.conffile (typically found in%APPDATA%/mpv/on Windows or~/.config/mpv/on Linux/macOS). - Open the file in a text editor.
- Add the following line on its own new line:
deband=yes
- 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:
deband-iterations: Controls the number of filtering steps. Higher values catch more banding but utilize more GPU power. (Default is 1, recommended maximum is 4).deband-threshold: Sets the filter sensitivity. A higher threshold removes more banding but can accidentally blur fine, intentional details in the video texture. (Default is 32).deband-range: Defines the radius from which the filter samples neighboring pixels. A larger range is effective for wide, sweeping gradients. (Default is 16).deband-grain: Injects extra dynamic noise to mask remaining bands. Setting this too high can make the video look excessively grainy. (Default is 48).
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