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 Auto-Generate GIFs with Bannerbear in Node.js: A Step-by-Step Guide for Developers

    Learn how to integrate GIF generation into your website or app using Bannerbear in Node.js! This step-by-step guide helps developers effortlessly automate the creation of slideshow-like GIFs to enhance visuals and improve user engagement.

    Top 5 FFmpeg GUIs to Simplify Media Manipulation

    Discover the top 5 FFmpeg GUIs to simplify media manipulation. Learn how HandBrake, Shutter Encoder, Shotcut, QWinFF, and StaxRip simplify FFmpeg through a user interface.

    How to Automatically Create Multi-Time Zone Event Posters with Node.js and Bannerbear

    Hosting online events, workshops, or webinars for a global audience? Use Bannerbear in Node.js to automatically generate event posters with the correct time zones for different regions!

    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