The environment

  • windows 10 64bit
  • ffmpeg N-93125-gdbfd042983

preface

Blur is an important work in video post production. Instead of using expensive proprietary commercial software, we can use FfMPEG’s BoxBlur for video blur. In this article we will use the function of Boxblur to blur the video.

Basic use of Boxblur

Before looking at the full command, how to use boxblur in the complex filter filter_complex

"[0:v]crop=400:400:300:350,boxblur=10[fg]; [0:v][fg]overlay=300:350[v]"
Copy the code

Explain:

  • crop=400:400:300:350Represents a region of 400×400 pixels whose upper-left coordinate is (300, 350)

  • Overlay =300:350 this value determines the position of the overlay in crop. Unless there is a specific requirement, it is usually set to the last two coordinates in crop to ensure that the blur is positioned in the Crop box

  • The parameter 10 represents the ambiguity coefficient. You can also set luma, Chroma, and Alpha separately. If not set, it defaults to 2

In field

ffmpeg -i test.mp4 -filter_complex "[0:v]crop=200:200:300:350,boxblur=10[fg]; [0:v][fg]overlay=300:350[v]" -map "[v]" output.mp4
Copy the code

Here is what the output looks like, with a 200×400 blurred area in the video

Let’s change the top 10 to 50 and see what happens

As you can see, the larger the number, the more ambiguous it gets

Finally, let’s look at an example where we blur the parts of the video outside of the specified area

ffmpeg -i test.mp4 -filter_complex "[0:v]boxblur=10[bg]; [0:v]crop=200:200:300:350[fg]; [bg][fg]overlay=300:350" -map 0:v output.mp4Copy the code

The resulting result looks something like this