The pad filter adds padding (usually black) around the video to fit a target aspect ratio. The classic use is letterboxing 4:3 content into a 16:9 frame for delivery, or pillarboxing 16:9 into a 4:3 frame for an older player. The output is the same video centered with black bars on the missing area.

The command

ffmpeg -i input.mp4 -vf "pad=1920:1080:(1920-iw)/2:(1080-ih)/2:black" output.mp4

What it does

FFmpeg pads each frame to 1920x1080, placing the original video centered. The expression (1920-iw)/2 computes the horizontal offset to center the video: the difference between the target width and the input width, divided by two. The :black is the fill color.

When to use it

For fitting a 4:3 source into a 16:9 delivery, or for adding letterbox bars to a 2.39:1 film so it displays correctly on a 16:9 player without cropping. Pillarbox (vertical bars) is the same filter with the expressions swapped; both are 16:9-to-X aspect conversion.

Video and audio requirements

Any decodable video. The output dimensions must be large enough to contain the source. pad=1920:1080 pads a source smaller than 1920x1080; for sources already 1920x1080, the filter is a no-op. Audio is unaffected.

Things to avoid

  • Using pad to fake an aspect ratio change without changing the SAR. The result plays with the new pixel dimensions but the same display aspect as the source. Set the SAR explicitly with setdar=16/9 if the deliverable expects a 16:9 frame.
  • Forgetting that :black can be any color. :0x808080 for gray, :red for red, or a pixel value. For a transparent pad, use a non-standard pixel format like yuva420p and :0x00000000.
  • Combining with scale in the wrong order. scale, pad scales first, then pads; the pad is the larger size. pad, scale pads first, then scales; the scale might shrink the padded frame. Usually scale, pad is what you want.
  • Using pad for anamorphic sources. An anamorphic source has non-square pixels and should be corrected with setdar, not padded. Padding an anamorphic source produces a stretched or squeezed image.