FFmpeg delivers a lot of video filters including a filter called “delogo”. This one can be used to remove a station logo from a video.

How it works

First we need to define a square that contains the logo. Then the filter uses surrounding pixels outside of the square to calculate new pixels that are replacing the logo.

Step by Step

FFmpeg is easy to use: Just define with the parameter -i an input file (the original video file). Place at the end the output file name:

./ffmpeg -i InputVideo.mp4 OutputVideo.mp4

Let’s have a look at the filter. For this filter 4 parameters are required:

  • x and y define the position of the square with the logo
  • w and h define the width and height of the square containing the logo

The parameters are separated by a “:”. As an example: This filter removes a station logo at position 90×945 with a width and height of 85 pixels.

delogo=x=90:y=945:w=85:h=85

Now we need to add the filter to the FFmpeg command using -vf:

./ffmpeg -i InputVideo.mp4 -vf delogo=x=90:y=945:w=85:h=85 OutputVideo.mp4

And this is the result:

Was easy, right?

Troubleshooting

Sometimes the logo is still visible in the output file. Then you should check the parameters x/y for the position (maybe another position in the video is blurred) or the value for width and height should be increased.

If you have no idea where the filter is applied you can append the parameter:

show=1
./ffmpeg -i InputVideo.mp4 -vf delogo=x=90:y=945:w=85:h=85:show=1 OutputVideo.mp4

Then the square is surrounded by a green box.

For testing you can also add the FFmpeg parameter -t 15 to encode just the first 15 seconds.

./ffmpeg -i InputVideo.mp4 -vf delogo=x=90:y=945:w=85:h=85:show=1 -t 15 OutputVideo.mp4