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.

    FFmpeg Video Editing Essentials: Trimming, Merging, Subtitling, and More!

    As an open-source tool, FFmpeg provides a wide array of functions for handling media files. Let's learn how to use FFmpeg to edit videos programmatically, including trimming, merging, adding subtitles, etc.

    How to Automatically Transcribe Audio Like a Pro using AI Tools and APIs

    In this article, we will guide you on how to transcribe audio, and list several tools for doing it automatically, such as Amazon Transcribe, Google Cloud Speech-to-Text, Whisper by OpenAI, Azure AI Speech, and AssemblyAI.

    How to Auto-Generate Subtitles/Closed Captions for Tiktok & Instagram

    In this article, we will walk you through the steps of using Bannerbear’s API to automatically generate and add closed captions to videos. This helps you to add an auto-captioning feature for videos to your video editing application easily.

    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