sab (Shape Adaptive Blur)

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#sab

“sab” is “Shape Adaptive Blur” filter.

The official document does not say anything detailed and I could not find a descriptive explanation of this “Shape Adaptive Blur”. So I do not know about “What makes us happy?” of this filter. As inferred from the name, I expect that this filter will blur while keeping shape (edge), is it so?

In anyways, the usage of the “sab” (Shape Adaptive Blur) filter is very similar to “smartblur”. However, since the value range and meaning of the specified value are different, it is difficult to compare with “smartblur” given the similar value.

  • xxx_radius: blur filter strength.

  • xxx_strength: maximum difference between pixels to still be considered.

  • xxx_pre_filter_radius: pre-filter radius.

#! /bin/sh
ifn="Grape_Vineyard.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

# luma radius: 0.1 ... 4
# luma strength
luma_radius=${luma_radius:-2.0}
luma_strength=${luma_strength:-5.0}
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]split[0v1][0v2];

[0v1]crop=900:500:30:580,setsar=1,
sab=lr=${luma_radius}:ls=${luma_strength}

,drawbox=c=blue[b];

[0v2][b]overlay=30:580[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"