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.

    Bannerbear Beginner Guide: How to Start Generating Images Dynamically in JavaScript with Bannerbear

    If you want to integrate dynamic image generation into your JavaScript project, this article is for you! Learn how to do it effortlessly with Bannerbear—we’ll walk you through the entire process, from setup and implementation to achieving the final result.

    How to Automatically Create Eye-Catching Images for Your App's Link Sharing Using Bannerbear (Node.js)

    Want to make your app’s link sharing stand out? Learn how to use Bannerbear to automatically create eye-catching images that boost click-through rates! This tutorial walks you through building a backend service with Node.js to automatically generate custom images based on dynamic data.

    How to Auto-Generate Social Media Posts For a Business Conference Using Bannerbear (Node.js): Part 2

    In Part 2 of our series on auto-generating social media posts for a business conference using Bannerbear, we'll be creating posts for panel sessions. The image for each post will feature key details like the session topic, moderator, and panelists.

    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