Blurring Multiple Areas No Longer Works with ffmpeg 4.4
I'd like to blurr 3 areas of a video. This is the code:
$ ffmpeg -i ACCT.mp4 -an \
-filter_complex \
"[0:v]crop=850:100:140:175,boxblur=10[blur1]; \
[0:v]crop=125:285:815:395,boxblur=10[blur2]; \
[0:v]crop=80:30:730:640,boxblur=10[blur3]; \
[0:v][blur1]overlay=140:175:enable='between(t,0,26)'[ovr1]; \
[ovr1][blur2]overlay=815:395:enable='between(t,0,2)'[ovr2]; \
[ovr2][blur3]overlay=730:640:enable='between(t,7,29)'" \
blurredVideo.mp4
Unfortunately, ffmpeg reports the following error:
[Parsed_boxblur_5 @ 0x7fcfbb805b40] Invalid chroma_param radius value 10, must be >= 0 and <= 7
[Parsed_boxblur_5 @ 0x7fcfbb805b40] Failed to evaluate filter params: -22.
[Parsed_boxblur_5 @ 0x7fcfbb805b40] Failed to configure input pad on Parsed_boxblur_5
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!
The code is based on a valid answer to another post.
Problem
boxblur has size limitations. See the boxblur filter documentation for all of the details.
Solutions
Use a different blur filter
Use as avgblur, dblur, gblur, sab, smartblur, unsharp, yaepblur. See FFmpeg Filters.
$ ffmpeg -i ACCT.mp4 -an \
-filter_complex \
"[0:v]crop=850:100:140:175,avgblur=10[blur1]; \
[0:v]crop=125:285:815:395,avgblur=10[blur2]; \
[0:v]crop=80:30:730:640,avgblur=10[blur3]; \
[0:v][blur1]overlay=140:175:enable='between(t,0,26)'[ovr1]; \
[ovr1][blur2]overlay=815:395:enable='between(t,0,2)'[ovr2]; \
[ovr2][blur3]overlay=730:640:enable='between(t,7,29)'" \
blurredVideo.mp4
Or use boxblur before crop
This will be slower than your original command.
$ ffmpeg -i ACCT.mp4 -an \
-filter_complex \
"[0:v]boxblur=10,crop=850:100:140:175[blur1]; \
[0:v]boxblur=10,crop=125:285:815:395[blur2]; \
[0:v]boxblur=10,crop=80:30:730:640[blur3]; \
[0:v][blur1]overlay=140:175:enable='between(t,0,26)'[ovr1]; \
[ovr1][blur2]overlay=815:395:enable='between(t,0,2)'[ovr2]; \
[ovr2][blur3]overlay=730:640:enable='between(t,7,29)'" \
blurredVideo.mp4
Or add the format filter
$ ffmpeg -i ACCT.mp4 -an \
-filter_complex \
"[0:v]crop=850:100:140:175,format=yuv444p,boxblur=10[blur1]; \
[0:v]crop=125:285:815:395,format=yuv444p,boxblur=10[blur2]; \
[0:v]crop=80:30:730:640,format=yuv444p,boxblur=10[blur3]; \
[0:v][blur1]overlay=140:175:enable='between(t,0,26)':format=auto[ovr1]; \
[ovr1][blur2]overlay=815:395:enable='between(t,0,2)':format=auto[ovr2]; \
[ovr2][blur3]overlay=730:640:enable='between(t,7,29)':format=auto,format=yuv420p" \
blurredVideo.mp4
Also see
- Invalid radius value in BlurMask Ffmpeg
- FFMPEG: Changing the filter prevents the video from being blurred