Remove Video Logos with FFmpeg Delogo Filter
The delogo filter in FFmpeg allows you to suppress or
blur unwanted watermarks, broadcast bugs, and logos from a video by
interpolating surrounding pixels over a specified rectangular area. This
guide covers how the filter works, how to accurately find the logo's
coordinates, how to preview the target area, and how to execute the
command to clean your video without re-encoding audio.
How the delogo Filter
Works
The delogo filter removes a logo by sampling pixels from
a specified border area around the watermark and calculating an
interpolation to fill the rectangle. While it does not reconstruct
hidden details, it effectively softens, blurs, and blends the target
area into the surrounding footage, making static logos significantly
less noticeable.
Step 1: Identify Logo Coordinates
To use the filter, you must specify the exact position and dimensions of the logo in pixels:
- x: The horizontal offset from the top-left corner.
- y: The vertical offset from the top-left corner.
- w: The width of the rectangle covering the logo.
- h: The height of the rectangle covering the logo.
To find these values, take a screenshot of a frame from your video at its native resolution, open it in an image editor like GIMP, Photoshop, or MSPaint, and use the selection tool to measure the logo's bounding box.
Step 2: Preview the Bounding Box
Before processing the entire video, use the show=1
parameter to draw a green rectangle around the target area. This allows
you to verify that the coordinates cover the logo completely.
ffplay -i input.mp4 -vf "delogo=x=100:y=50:w=120:h=60:show=1"If using ffmpeg to export a quick test clip:
ffmpeg -ss 00:00:10 -i input.mp4 -t 5 -vf "delogo=x=100:y=50:w=120:h=60:show=1" -c:a copy test_preview.mp4Adjust the x, y, w, and
h values until the green box completely encloses the
watermark with minimal extra space.
Step 3: Apply the Filter to the Full Video
Once the dimensions are verified, remove the show=1
parameter (or set it to 0) and run the full command:
ffmpeg -i input.mp4 -vf "delogo=x=100:y=50:w=120:h=60" -c:v libx264 -crf 18 -c:a copy output.mp4-c:v libx264: Re-encodes the video stream using H.264 (filtering requires video re-encoding).-crf 18: Sets a high visual quality output (lower values mean higher quality; 18–23 is standard).-c:a copy: Copies the audio stream directly without re-encoding to save time and preserve sound quality.
Optional Parameters
You can fine-tune the interpolation behavior using the
band parameter:
- band (or
b): Specifies the thickness of the border edge around the rectangle used to sample surrounding pixels (default is1). Increasing this value (e.g.,band=2orband=4) can create a smoother gradient if the video background around the logo contains gradients or noise.
Example using custom band thickness:
ffmpeg -i input.mp4 -vf "delogo=x=100:y=50:w=120:h=60:band=2" -c:v libx264 -crf 18 -c:a copy output.mp4