Configure FFmpeg Delogo Filter Coordinates and Thickness
Removing watermarks or logos from a video requires precise
positioning to prevent unnecessary blurring of the surrounding video.
This article provides a straightforward guide on how to configure the
exact bounding coordinates (x, y,
w, h) and the transition band thickness
(band) of the delogo filter in FFmpeg.
The delogo filter in FFmpeg works by interpolating the
pixels inside a specified rectangular area using the pixels immediately
surrounding it. To use it effectively, you must define the precise
location and size of the logo, along with the thickness of the blending
band.
The Delogo Syntax
The basic syntax for the delogo filter is:
delogo=x=X_COORD:y=Y_COORD:w=WIDTH:h=HEIGHT:band=THICKNESS
Finding the Exact Coordinates
To find the exact pixel values for your video, follow these steps: 1. Take a lossless screenshot of your video at its native resolution. 2. Open the image in an image editor (such as GIMP, Photoshop, or Paint). 3. Use the selection tool to highlight the logo. 4. Note the X and Y coordinates of the top-left corner of your selection. 5. Note the Width (W) and Height (H) of the selection box.
Configuring the Parameters
x: The distance from the left edge of the video frame to the left edge of the logo (in pixels).y: The distance from the top edge of the video frame to the top edge of the logo (in pixels).w: The width of the logo box.h: The height of the logo box.band: The thickness of the fuzzy border (in pixels) added around the selected box. The default value is1. A higher value creates a smoother transition between the interpolated area and the original video but increases the overall blurred area.
Example Command
Suppose your logo starts 40 pixels from the left (x=40),
30 pixels from the top (y=30), has a width of 120 pixels
(w=120), a height of 50 pixels (h=50), and you
want a band thickness of 4 pixels (band=4) to smooth the
edges:
ffmpeg -i input.mp4 -vf "delogo=x=40:y=30:w=120:h=50:band=4" -c:a copy output.mp4Testing Your Coordinates
To verify that your bounding box perfectly covers the logo without
guessing, you can use the show parameter. Setting
show=1 draws a green rectangle around the specified
coordinates:
ffmpeg -i input.mp4 -vf "delogo=x=40:y=30:w=120:h=50:band=4:show=1" -c:a copy preview.mp4Once you confirm the green box aligns perfectly with the logo, remove
:show=1 from the command to render the final, blurred
output.