FFMPEG filter to boxblur and greyscale a video using alpha mask
Solution 1:
Here's a method using alphamerge
, hue
, boxblur
, and overlay
.
Original input, filtered output, mask image.
Example:
ffmpeg -i input -loop 1 -i mask.png -filter_complex \
"[0:v][1:v]alphamerge,hue=s=0,boxblur=5[fg]; \
[0:v][fg]overlay[v]" -map "[v]" -map 0:a -c:a copy output
The mask should be the same size as the input. If it isn't you could use
scale
orscale2ref
to resize it.The audio is stream copied to avoid unnecessary encoding.