FFmpeg Vertical to Horizontal Video with Blurred Sidebars

Converting a vertical 9:16 video into a horizontal 16:9 format often leaves ugly black bars on the sides. This article provides the exact FFmpeg command and filter chain required to replace those black bars with a modern, aesthetically pleasing blurred background generated from the original video.

To achieve this effect, FFmpeg splits the input video into two streams: one for the background and one for the foreground. The background stream is scaled up, cropped to fill the 16:9 canvas, and heavily blurred. The foreground stream is scaled to fit the height of the canvas and overlaid directly in the center.

The FFmpeg Command

Run the following command in your terminal to process your video. This example assumes a standard output resolution of 1920x1080 (1080p horizontal):

ffmpeg -i input.mp4 -lavfi "[0:v]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,boxblur=20:10[bg]; [0:v]scale=-1:1080[fg]; [bg][fg]overlay=(W-w)/2:(H-h)/2" -c:a copy output.mp4

Command Breakdown

The core of this command relies on the complex filtergraph (-lavfi). Here is how each part of the filter works:

Customizing the Output

You can easily adjust this command to fit your specific needs: