FFmpeg: Overlay Scrolling Text on Blurred Background Video

This article explains how to use FFmpeg to create a professional video layout featuring a blurred background of your video, a centered sharp version of the same video on top, and a scrolling text box overlay. You will learn the exact FFmpeg command required to achieve this effect, along with a detailed breakdown of how the filtergraph processes the video and text layers.

The Complete FFmpeg Command

To create a blurred background from your input video, overlay the sharp original video in the center, and add a horizontally scrolling text box at the bottom, run the following command:

ffmpeg -i input.mp4 -filter_complex \
"[0:v]split=2[bg][fg]; \
 [bg]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,boxblur=20:5[bg_blur]; \
 [fg]scale=-1:1080[fg_scale]; \
 [bg_blur][fg_scale]overlay=(W-w)/2:(H-h)/2[base]; \
 [base]drawtext=text='Your scrolling announcement text goes here...':x=w-t*150:y=h-150:fontsize=36:fontcolor=white:box=1:boxcolor=black@0.6:boxborderw=20[outv]" \
 -map "[outv]" -map 0:a? -c:a copy output.mp4

How the Command Works

The command utilizes FFmpeg’s -filter_complex flag to chain several video filters together in a single pass:

  1. Splitting the Input (split): [0:v]split=2[bg][fg] duplicates the input video stream into two identical streams, named bg (background) and fg (foreground).
  2. Creating the Blurred Background (scale, crop, boxblur):
    • scale=1920:1080:force_original_aspect_ratio=increase scales the background stream to fill a 1920x1080 canvas.
    • crop=1920:1080 cuts off any excess video to ensure a perfect 16:9 ratio.
    • boxblur=20:5 applies a heavy blur effect to this background layer.
  3. Scaling the Foreground (scale): scale=-1:1080 scales the second video stream to a height of 1080 pixels while preserving its original aspect ratio.
  4. Overlaying the Streams (overlay): overlay=(W-w)/2:(H-h)/2 places the sharp foreground video directly in the center of the blurred background video.
  5. Adding the Scrolling Text Box (drawtext):
    • text='...': Specifies the scrolling message.
    • x=w-t*150: Animates the text horizontally. It starts at the right edge of the screen (w) and moves left at a speed of 150 pixels per second multiplied by the timestamp (t).
    • y=h-150: Positions the text box 150 pixels from the bottom of the video frame.
    • box=1:boxcolor=black@0.6:boxborderw=20: Creates a solid black background box behind the text with 60% opacity (0.6) and 20 pixels of padding (boxborderw) to act as the text box container.

Customization Tips