How to Apply a Gaussian Blur to a Video with FFmpeg

Blurring a video is actually quite simple with FFmpeg, although you will need a few attempts to see what settings work best for you
by Jon Yongfook ·

Contents

    Blurring a video is actually quite simple with FFmpeg, although you will need a few attempts to see what settings work best for you.

    Sometimes you may want to blur a video, for various reasons. You may want to anonymize the people in it, you may want to use it as a background etc.

    Blurring can be achieved natively in FFmpeg via a simple command.

    What is a Gaussian Blur?

    A blur is not just a blur.

    You can blur an image using different calculations / formulas and the results will be slightly different. The most common types of blur are radial blur, box blur, variable blur and gaussian blur.

    A gaussian blur is a particular type of blur. It is a type of blur effect that uses a Gaussian function for calculating the transformation to apply to each pixel in the image.

    Can FFmpeg do guassian blurs?

    Yes, FFmpeg supports two types of blur effects - box blur and gaussian blur. We will take a look at both in this article.

    Baseline video

    Here is the video we will be applying blur effects to:

    Applying a mild box blur effect

    ffmpeg -i man.mp4 -vf "boxblur=10" -c:a copy man-blur.mp4

    Applying a strong box blur effect

    Increasing the number of the boxblur filter increases the radius of the blur.

    ffmpeg -i man.mp4 -vf "boxblur=50" -c:a copy man-blur-more.mp4

    Applying a very strong box blur effect

    You can increase the intensity of the blur with a second parameter, below uses a radius value of 50 that is then applied 5 times resulting in a very strong blur effect.

    ffmpeg -i man.mp4 -vf "boxblur=50:5" -c:a copy man-blur-more-more.mp4

    Now lets use the same parameters on the gaussian blur effect filter gblur.

    Applying a mild gaussian blur effect

    In FFmpeg the gblur filter takes 2 parameters, the standard deviation and the number of steps for gaussian approximation. Standard deviation will range from 0.5 upwards while steps can be a number from 1 to 6.

    ffmpeg -i man.mp4 -vf "gblur=sigma=10" -c:a copy man-gblur.mp4

    Applying a strong gaussian blur effect

    ffmpeg -i man.mp4 -vf "gblur=sigma=50" -c:a copy man-gblur-more.mp4

    Applying a very strong gaussian blur effect

    As with the box blur you can increase the intensity of the blur with a second parameter, below uses a sigma value of 50 that is then applied 5 times resulting in a very strong blur effect.

    ffmpeg -i man.mp4 -vf "gblur=sigma=50:steps=5" -c:a copy man-gblur-more-more.mp4

    Which blur should you use?

    In the end the decision is mostly an aesthetic one. The best way of thinking about the visual difference between a box blur and a gaussian blur is that a box blur gets you an effect similar to the bokeh effect of an SLR camera. A gaussian blur on the other hand, is more like a "frosted glass" effect.

    Use the Bannerbear Video API

    If you need to perform these kinds of FFmpeg operations in the cloud, you can try using the Bannerbear Video API which simplifies this FFmpeg command line experience and makes it more developer-friendly for performing common tasks like blurring videos, joining video clips, turning images into slideshows and more.

    About the authorJon Yongfook@yongfook
    Jon is the founder of Bannerbear. He has worked as a designer and programmer for 20 years and is fascinated by the role of technology in design automation.

    How to Automatically Create Translated Banner Graphics for Multilingual Websites Using GPT-4o and Bannerbear

    OpenAI’s advanced language models significantly enhances text-related tasks, especially with the GPT-4o. In this article, we’ll guide your through the steps of using GPT-4o and Bannerbear to automate the translation and generation of banner graphics in various languages for multilingual websites.

    How to Automatically Add Watermark to Instagram Reels For Reposting Using Bannerbear (Node.js Tutorial)

    Posting a mix of original and user-generated content, including properly credited reposts, can be an effective social media strategy for media companies to engage with their audience and keep their feed dynamic and interesting. Let's learn how to streamline this process using Bannerbear in Node.js!

    How to Automatically Add Personalized Images to Your Beehiiv Newsletter

    Learn how to enhance your Beehive newsletter with personalized images using Bannerbear. In this article, we will learn how to automatically add personalized images to Beehiiv newsletters to make the content more relevant and engaging for your subscribers.

    Automate & Scale
    Your Marketing

    Bannerbear helps you auto-generate social media visuals, banners and more with our API and nocode integrations

    How to Apply a Gaussian Blur to a Video with FFmpeg
    How to Apply a Gaussian Blur to a Video with FFmpeg