I need to blur some uploaded videos and encoded them. Infact by blur, it means pixellate them so "big squares" appear and blur it.
Any idea on how I can do that ? (ffmpeg would be great, by any command line windows tool should be ok)
Thanks.
Example:
ffmpeg -i input -vf "frei0r=filter_name=pixeliz0r:filter_params=0.02|0.02" output
The two pixeliz0r filter_params
parameters are:
Larger values will create larger blocks.
Windows users can get the "full build" from gyan.dev.
Linux users can download or compile:
frei0r.h
(such as frei0r-plugins-dev in Ubuntu or frei0r-devel in CentOS) and then add --enable-frei0r
to your ffmpeg configure. See FFmpeg Wiki: Compile Guides.macOS users can use Homebrew. You may need the --with-frei0r
option.
If you don't want to install the frei0r plugin for this, there's an alternative way.
dimensions=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of "csv=p=0:s=\:" input)
ffmpeg -i input -filter_complex \
"[0:v] scale='iw/15:-1', scale='$dimensions:flags=neighbor'" output
This scales down the input size (in this example, by 15) and then scales it back up to the original dimensions. The flags=neighbor
tells ffmpeg to use the nearest neighbor rescaling algorithm which results in the pixelated effect. You can change the block size by changing the number 15.
The first line is needed to find out the input's original dimensions and scale back directly to it, otherwise the scaling down and scaling up might result in rounding errors that slightly alter the size of the output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With