Sunday 16 December 2018

FFMPEG filter to boxblur and greyscale a video using alpha mask


Can someone show me how to enhance the example found here: FFmpeg - Apply blur over face


To do the following:



  1. Use an input alpha mask PNG instead of a declared rectangular region

  2. both blur and greyscale the masked region


This is another example - showing how to use an alpha mask file Crop triangular area with FFMPEG


Thanks



Answer



Here's a method using alphamerge, hue, boxblur, and overlay.


original blurred mask


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 or scale2ref to resize it.




  • The audio is stream copied to avoid unnecessary encoding.




No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...