How to Blur Vertical Video Background in FFmpeg
This guide explains how to convert a vertical video into a standard
16:9 landscape format using FFmpeg by generating a blurred background
from the original footage. Using the filter_complex engine,
you can scale the source video to fill a horizontal frame, apply a
boxblur filter, and overlay the unscaled original vertical
video directly in the center.
The Complete FFmpeg Command
To convert a vertical video (9:16) to a horizontal video (16:9, 1920x1080) with a blurred background, run the following command:
ffmpeg -i input.mp4 -filter_complex \
"[0:v]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,boxblur=20:5[bg]; \
[0:v]scale=-1:1080[fg]; \
[bg][fg]overlay=(W-w)/2:(H-h)/2" \
-c:a copy output.mp4How the Filtergraph Works
The command splits the processing of the single input
([0:v]) into two distinct visual layers before combining
them:
1. The Background Layer
([bg])
scale=1920:1080:force_original_aspect_ratio=increase: Scales the vertical video up until it completely covers the 1920x1080 canvas, preserving the aspect ratio.crop=1920:1080: Crops any overflow pixels that extend outside the 1920x1080 frame boundaries.boxblur=20:5: Applies the box blur filter. The first value (20) represents the blur radius (strength), while the second value (5) represents the power (number of blur passes). Higher numbers create a smoother, heavier blur.
2. The Foreground Layer
([fg])
scale=-1:1080: Resizes the original vertical video so its height matches the target canvas (1080px) while automatically computing the proportional width (-1) to prevent distortion.
3. The Overlay
[bg][fg]overlay=(W-w)/2:(H-h)/2: Places the sharp foreground layer ([fg]) on top of the blurred background ([bg]). The mathematical expression(W-w)/2:(H-h)/2calculates the horizontal and vertical center coordinates dynamically.
4. Audio Handling
-c:a copy: Copies the audio stream directly without re-encoding to preserve original quality and speed up processing.
Dynamic Resolution Alternative
If you do not want to force a strict 1920x1080 canvas and prefer the output to adapt dynamically to match a 16:9 aspect ratio based on the input video's height:
ffmpeg -i input.mp4 -filter_complex \
"[0:v]scale=ih*16/9:ih:force_original_aspect_ratio=increase,crop=ih*16/9:ih,boxblur=25:5[bg]; \
[bg][0:v]overlay=(W-w)/2:0" \
-c:a copy output.mp4This variation uses the input height (ih) to
automatically establish a 16:9 width (ih*16/9), applying
the blur behind the original unmodified video feed.