FFmpeg Blurred Background Sidebars Using gblur

This article demonstrates how to use the FFmpeg gblur (Gaussian blur) filter to create professional-looking blurred background sidebars for vertical videos played on widescreen displays. By splitting a single video input into two streams, you can scale and blur one stream to serve as the background canvas while overlaying the original video, scaled to fit, directly in the center.

To achieve this effect, you will use FFmpeg's complex filtergraph (-filter_complex). Below is the standard command to convert a vertical video (9:16) into a widescreen horizontal video (16:9, 1920x1080) with blurred sidebars:

ffmpeg -i input.mp4 -filter_complex \
"[0:v]split=2[bg][fg]; \
 [bg]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,gblur=sigma=30:steps=3[bg_blurred]; \
 [fg]scale=-1:1080[fg_scaled]; \
 [bg_blurred][fg_scaled]overlay=(W-w)/2:(H-h)/2" \
-c:a copy output.mp4

How the Filtergraph Works

  • split=2[bg][fg]: This duplicates the input video stream into two identical, independent streams labeled [bg] (background) and [fg] (foreground).
  • Background Processing ([bg]...):
    • scale=1920:1080:force_original_aspect_ratio=increase scales the background video to fill a 1920x1080 canvas, ensuring no black bars are visible on the sides of the background itself.
    • crop=1920:1080 crops the scaled video to the exact 1920x1080 output dimensions.
    • gblur=sigma=30:steps=3 applies the Gaussian blur. The sigma parameter controls the strength of the blur (higher values mean more blur), and steps determines how many times the filter is applied to create a smoother gradient.
  • Foreground Processing ([fg]...):
    • scale=-1:1080 scales the original vertical video so its height matches the output height of 1080 pixels while preserving its original aspect ratio.
  • Overlaying (overlay...):
    • [bg_blurred][fg_scaled]overlay=(W-w)/2:(H-h)/2 places the scaled foreground video directly onto the center of the blurred background video. The mathematical expression (W-w)/2 centers the foreground horizontally, and (H-h)/2 centers it vertically.

Customizing the Blur Intensity

You can adjust the aesthetic of the background sidebars by modifying the parameters of the gblur filter:

  • sigma: Increase this value (e.g., sigma=50) for a more abstract, heavily blurred background, or decrease it (e.g., sigma=15) to keep background shapes recognizable.
  • steps: Increase this value to 3 or 4 to eliminate banding artifacts and produce a smoother blur. Note that higher step values require more processing power.