How to Use FFmpeg Delogo Filter to Remove Video Logos
This article provides a straightforward guide on how to use the
FFmpeg delogo filter to remove or blur unwanted logos,
watermarks, and on-screen graphics from your videos. You will learn the
basic command syntax, how to identify the correct coordinates for the
logo, and how to apply the filter to achieve a clean result.
Understanding the Delogo Filter
The delogo filter in FFmpeg removes an unwanted logo by
interpolating the surrounding pixels. Instead of detecting the logo
automatically, you define a rectangular bounding box over the logo.
FFmpeg then blends the pixels within that box with the surrounding image
to make the logo less noticeable.
The Basic Command Syntax
The basic syntax for the delogo filter is as
follows:
ffmpeg -i input.mp4 -vf "delogo=x=X:y=Y:w=W:h=H" output.mp4Parameter Breakdown:
x: The horizontal position of the top-left corner of the logo (in pixels) from the left edge of the video.y: The vertical position of the top-left corner of the logo (in pixels) from the top edge of the video.w: The width of the logo bounding box (in pixels).h: The height of the logo bounding box (in pixels).
Step-by-Step Guide
Step 1: Find the Logo Coordinates and Dimensions
To use the filter, you must first find the exact pixel coordinates
(x, y) and size (w,
h) of the logo. 1. Take a screenshot of your video
containing the logo. 2. Open the screenshot in an image editor (such as
Photoshop, GIMP, 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, as well as the
Width and Height of the selection.
Step 2: Run the FFmpeg Command
Suppose your video is 1920x1080, and you found a logo in the
top-right corner with the following measurements: * X coordinate
(x): 1700 * Y coordinate
(y): 50 * Width (w):
150 * Height (h): 75
You would run the following command to blur the logo:
ffmpeg -i input.mp4 -vf "delogo=x=1700:y=50:w=150:h=75" -c:a copy output.mp4(Note: -c:a copy is added to copy the audio stream
without re-encoding it, which saves processing time.)
Advanced Settings
Adjusting the Blend Border
The delogo filter has an optional parameter called
band which specifies the thickness of the fuzzy edge (in
pixels) around the coordinates. This helps blend the interpolated area
into the video. The default value is 4. You can increase this if the
edges of the blurred area look too sharp.
Example with a custom band thickness of 10:
ffmpeg -i input.mp4 -vf "delogo=x=1700:y=50:w=150:h=75:band=10" -c:a copy output.mp4Visualizing the Bounding Box
To ensure you have the correct coordinates before rendering the
entire video, you can use the show parameter. Setting
show=1 draws a green rectangle around the specified
coordinates.
Example for testing:
ffmpeg -i input.mp4 -vf "delogo=x=1700:y=50:w=150:h=75:show=1" -c:a copy test_output.mp4Once you verify that the green box covers the logo perfectly, run the
final command without :show=1 to apply the actual blur.