Draw a Solid Red Rectangle in FFmpeg Using drawbox

This article provides a straightforward guide on how to use the FFmpeg drawbox video filter to overlay a solid red rectangle onto a specific region of a video. You will learn the exact command syntax, how to define the box’s coordinates and dimensions, and how to configure the filter to fill the shape completely rather than drawing a simple outline.

To draw a solid red rectangle over a specific region of a video, you need to use the drawbox video filter (-vf) and set its thickness parameter to fill.

The FFmpeg Command

Here is the basic command template to achieve this:

ffmpeg -i input.mp4 -vf "drawbox=x=100:y=150:w=300:h=200:color=red:t=fill" -c:a copy output.mp4

Parameter Breakdown

Advanced Formatting Options

If you want to make the solid red rectangle semi-transparent, you can append an opacity value to the color parameter using the @ symbol:

ffmpeg -i input.mp4 -vf "drawbox=x=100:y=150:w=300:h=200:color=red@0.5:t=fill" -c:a copy output.mp4

In this variation, red@0.5 sets the opacity of the solid red rectangle to 50%, allowing the underlying video to remain partially visible.