How to Blur Video Using FFmpeg boxblur
This article provides a practical guide on how to blur a video using
the powerful boxblur filter in FFmpeg. You will learn the
fundamental syntax of the filter, understand how its key parameters
control the blur intensity, and see step-by-step command examples to
apply the effect to your videos immediately.
Understanding the Boxblur Syntax
The boxblur filter in FFmpeg applies a box blur effect
to the input video. The basic structure for the filter configuration is
defined as follows:
boxblur=luma_radius:luma_power[:chroma_radius:chroma_power[:alpha_radius:alpha_power]]
- Luma Radius (lr): The size of the blur box for the brightness (luma) component. A higher value increases the blur radius.
- Luma Power (lp): How many times the blur filter is applied. More passes create a smoother, heavier blur.
- Chroma Radius (cr) and Chroma Power (cp): Controls the blur for the color (chroma) components. If omitted, these values automatically copy the luma settings.
Basic Blur Command
To apply a standard, moderate blur to an entire video, run the following FFmpeg command in your terminal:
ffmpeg -i input.mp4 -vf "boxblur=10:1" output.mp4In this command, boxblur=10:1 sets the luma radius to
10 pixels and the power/passes to 1.
Creating a Heavy Blur
If you need a much stronger blur effect to completely obscure details, you can increase both the radius and the power parameters:
ffmpeg -i input.mp4 -vf "boxblur=25:5" output.mp4Using a radius of 25 with 5 power passes
creates a highly diffused, unrecognizable video.
Blurring a Specific Area of the Video
To blur only a specific portion of the video frame, you can combine
the boxblur filter with the crop and
overlay filters in a filter complex:
ffmpeg -i input.mp4 -filter_complex "[0:v]crop=300:300:100:100,boxblur=10:5[blurred];[0:v][blurred]overlay=100:100" output.mp4This command performs the following steps: 1.
crop=300:300:100:100: Isolates a 300x300
pixel square starting at the X=100, Y=100 coordinate. 2.
boxblur=10:5: Applies a strong blur to
this cropped area and labels the output stream as
[blurred]. 3.
overlay=100:100: Places the blurred square
back onto the original video at the exact location from which it was
cropped.