How to Use the FFmpeg Boxblur Filter
This article provides a straightforward guide on how to use the
boxblur filter in FFmpeg to apply blurring effects to video
files. You will learn the syntax of the filter, understand its key
parameters—such as radius and power for luma, chroma, and alpha
channels—and see practical command-line examples to easily apply these
effects to your projects.
Understanding Boxblur Parameters
The boxblur filter in FFmpeg accepts six primary
parameters. These parameters are grouped by video component:
luma (brightness/grayscale), chroma
(color), and alpha (transparency).
- radius (r): Defines the size of the blur area in pixels. A larger radius results in a stronger blur.
- power (p): Defines how many times the blur filter is sequentially applied. A higher power creates a smoother gradient blur but requires more processing power.
The basic syntax for the filter is:
boxblur=luma_radius:luma_power:chroma_radius:chroma_power:alpha_radius:alpha_power
You can also use the abbreviated parameter names: * lr /
lp (Luma radius / power) * cr /
cp (Chroma radius / power) * ar /
ap (Alpha radius / power)
Practical FFmpeg Boxblur Examples
Below are standard command-line examples showing how to apply the
boxblur filter to a video named input.mp4.
1. Apply a Simple Blur to the Entire Video
To blur both the details (luma) and colors (chroma) of a video, you
can set the radius to 10 and the power to 2
for both components:
ffmpeg -i input.mp4 -vf "boxblur=lr=10:lp=2:cr=10:cp=2" output.mp4Alternatively, you can use the short-hand positional notation:
ffmpeg -i input.mp4 -vf "boxblur=10:2:10:2" output.mp42. Apply a Heavy Blur
If you want a highly obscured, dream-like effect, increase both the radius and the power settings:
ffmpeg -i input.mp4 -vf "boxblur=lr=30:lp=5:cr=30:cp=5" output.mp43. Blur Only the Details (Keep Color Intact)
By applying the blur only to the luma channel and keeping the chroma
settings at 0, you can blur the details of the video while
preserving the original color boundaries:
ffmpeg -i input.mp4 -vf "boxblur=lr=15:lp=3:cr=0:cp=0" output.mp44. Using Expressions for Dynamic Radius
FFmpeg allows you to use mathematical expressions for the radius. For
example, you can set the blur radius based on the video width
(w) or height (h). The following command sets
the luma radius to 2% of the video’s width:
ffmpeg -i input.mp4 -vf "boxblur=lr=w*0.02:lp=2" output.mp4