deband

doc

https://ffmpeg.org/ffmpeg-filters.html#elbg, https://ffmpeg.org/ffmpeg-filters.html#deband

see also

elbg

deband:

Remove banding artifacts from input video. It works by replacing banded pixels with average value of referenced pixels.

1thr, 2thr, 3thr, 4thr

1thr, 2thr, 3thr, 4thr:

Set banding detection threshold for each plane. Default is 0.02. Valid range is 0.00003 to 0.5. If difference between current pixel and reference pixel is less than threshold, it will be considered as banded.

Watch on youtube.com
#! /bin/sh
pref="`basename $0 .sh`"
ifn="Pexels Videos 1457810.mp4"
thr=${thr:-0.002}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]deband=1thr=${thr}:2thr=${thr}:3thr=${thr}
" ${pref}.mp4

thr=0.005

00:00:00 00:02:18 00:04:36

thr=0.02

00:00:23 00:02:41 00:04:59

thr=0.05

00:00:46 00:03:04 00:05:22

thr=0.1

00:01:09 00:03:27 00:05:45

thr=0.25

00:01:32 00:03:50 00:06:08

thr=0.5

00:01:55 00:04:13 00:06:31

range

range:

Banding detection range in pixels. Default is 16. If positive, random number in range 0 to set value will be used. If negative, exact absolute value will be used. The range defines square of four pixels around current pixel.

Watch on youtube.com
#! /bin/sh
pref="`basename $0 .sh`"
ifn="Pexels Videos 1457810.mp4"
thr=${thr:-0.002}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]deband=1thr=${thr}:2thr=${thr}:3thr=${thr}:r=${r:-16}
" ${pref}.mp4

direction

direction:

Set direction in radians from which four pixel will be compared. If positive, random direction from 0 to set direction will be picked. If negative, exact of absolute value will be picked. For example direction 0, -PI or -2*PI radians will pick only pixels on same row and -PI/2 will pick only pixels on same column.

Watch on youtube.com
#! /bin/sh
pref="`basename $0 .sh`"
ifn="input.mp4"
thr=${thr:-0.002}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]deband=1thr=${thr}:2thr=${thr}:3thr=${thr}:d=${d:--PI/2}
" ${pref}.mp4

blur

blur:

If enabled, current pixel is compared with average value of all four surrounding pixels. The default is enabled. If disabled current pixel is compared with all four surrounding pixels. The pixel is considered banded if only all four differences with surrounding pixels are less than threshold.

Watch on youtube.com
#! /bin/sh
pref="`basename $0 .sh`"
ifn="Pexels Videos 1457810.mp4"
thr=${thr:-0.002}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]deband=1thr=${thr}:2thr=${thr}:3thr=${thr}:b=${b:-0}
" ${pref}.mp4

coupling

coupling:

If enabled, current pixel is changed if and only if all pixel components are banded, e.g. banding detection threshold is triggered for all color components. The default is disabled.

Watch on youtube.com
#! /bin/sh
pref="`basename $0 .sh`"
ifn="input.mp4"
thr=${thr:-0.002}
thr2=${thr:-0.002}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]deband=1thr=${thr}:2thr=${thr2}:3thr=${thr2}:c=${c:-1}
" ${pref}.mp4

Input video of above example was generated by:

#! /bin/sh
ffmpeg -y -filter_complex "

color=s=1920x1080,format=yuv444p,loop=-1:size=2,trim=0:20
,geq='
lum=64*floor(mod(X+T*100,W)/64)*(255/W):
cr=128-mod(X+T*100,W)*(64/W):
cb=128+mod(X+T*100,W)*(64/W)'
" grad.mp4