FFmpeg Blurred Background for Vertical Video
This guide explains how to convert a vertical 9:16 smartphone video
into a standard horizontal 16:9 format using FFmpeg. By utilizing the
filter_complex engine, you can generate a blurred,
full-width version of the original clip to serve as a backdrop while
placing the sharp, unaltered vertical footage centered on top.
The Complete FFmpeg Command
To create a 1080p (1920x1080) landscape video from a vertical source, 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:v libx264 -crf 18 -preset fast -c:a copy output.mp4How the Filtergraph Works
The command uses a three-step filter chain to create the effect:
- Create the Background Layer (
[bg])scale=1920:1080:force_original_aspect_ratio=increase: Scales the vertical video up until it completely covers the 1920x1080 frame, preserving its original aspect ratio.crop=1920:1080: Cuts off the top and bottom portions that overflow the target canvas.boxblur=20:5: Applies a heavy box blur to obscure the background. The first parameter controls the blur radius, while the second controls the blur power (iterations).
- Create the Foreground Layer (
[fg])scale=-1:1080: Scales the sharp original video so its height matches the 1080p container height while calculating the corresponding width automatically to prevent distortion.
- Composite the Layers
overlay=(W-w)/2:(H-h)/2: Places the sharp foreground layer ([fg]) directly in the horizontal and vertical center of the blurred background layer ([bg]).
Output Options
-c:v libx264: Encodes the video using the standard H.264 video codec for broad compatibility.-crf 18: Controls visual quality. Lower values produce higher quality (17–23 is standard).-preset fast: Balances encoding speed and file compression efficiency.-c:a copy: Copies the original audio stream directly without re-encoding to preserve quality and reduce processing time.
Alternative: Using
Gaussian Blur (gblur)
If you prefer a smoother visual blur instead of boxblur,
replace boxblur=20:5 with gblur:
ffmpeg -i input.mp4 -filter_complex \
"[0:v]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,gblur=sigma=40[bg]; \
[0:v]scale=-1:1080[fg]; \
[bg][fg]overlay=(W-w)/2:(H-h)/2" \
-c:v libx264 -crf 18 -preset fast -c:a copy output.mp4Adjust the sigma=40 parameter higher for a heavier blur
or lower for a lighter blur. Note that gblur requires
slightly more CPU processing time than boxblur.