Blur a Specific Region of a Video Using FFmpeg

This article provides a straightforward guide on how to isolate and blur a specific geographic area within a video frame using FFmpeg on a Linux system. You will learn the exact command-line syntax required to apply a localized blur, understand how the delogo and boxblur filters work, and see practical examples for targeting exact coordinates.


Understanding the FFmpeg Blur Method

To blur a specific region instead of the entire video, FFmpeg relies on specialized video filters. While there are multiple ways to achieve this, the two most efficient methods involve the delogo filter for quick rectangular blurs, and a combination of crop, boxblur, and overlay filters for advanced, highly customizable blurring.

Method 1: The Quick Way Using the Delogo Filter

The delogo filter is traditionally used to remove station watermarks, but it doubles as an excellent, lightweight tool for blurring a specific rectangular region. It interpolates the pixels surrounding the specified rectangle to obscure the target area.

The basic syntax is: ffmpeg -i input.mp4 -vf "delogo=x=100:y=200:w=300:h=150" output.mp4

In this command, the parameters define the bounding box:

Method 2: The Advanced Way Using Boxblur and Overlay

If you need a stronger, more traditional Gaussian-style blur, you can create a filter graph that duplicates the video, crops it to the target area, applies a blur, and overlays it back onto the original video.

The syntax for this advanced method is: ffmpeg -i input.mp4 -filter_complex "[0:v]crop=300:150:100:200,boxblur=10 [blurred]; [0:v][blurred]overlay=100:200" output.mp4

Here is how this complex filter breaks down:

Finding the Exact Coordinates

To make these commands work effectively, you must know the pixel dimensions of your video and the exact coordinates of the region you want to hide. You can find these coordinates by opening a screenshot of the video in an image editor like GIMP, hovering your mouse over the target area, and reading the pixel coordinates displayed in the status bar.