How to Select xBR Upscaling Factor in FFmpeg

This article explains how to select and configure the upscaling factor (2x, 3x, or 4x) using the xbr (Scale by Rules) video filter in FFmpeg. You will learn the exact command-line syntax, the available parameters, and practical examples to successfully upscale pixel art and low-resolution videos.

To select the upscaling factor in the FFmpeg xbr filter, you use the size option. The xbr filter supports three specific scaling factors: 2 (for 2x upscaling), 3 (for 3x upscaling), and 4 (for 4x upscaling). The default value is 3.

Syntax

You can define the upscaling factor using either the named parameter size or as a positional argument directly after the filter name:

  • Named parameter: xbr=size=N
  • Positional parameter: xbr=N

(Where N can be 2, 3, or 4)

Command Examples

1. Scale Video by 2x (2xBR)

To upscale your input video to twice its original width and height, use the value 2:

ffmpeg -i input.mp4 -vf "xbr=2" output.mp4

2. Scale Video by 3x (3xBR)

To upscale your input video to three times its original dimensions (this is the default behavior if no size is specified):

ffmpeg -i input.mp4 -vf "xbr=3" output.mp4

3. Scale Video by 4x (4xBR)

To upscale your input video to four times its original width and height, use the value 4:

ffmpeg -i input.mp4 -vf "xbr=4" output.mp4

Key Considerations

  • No Arbitrary Scaling: The xbr filter only accepts the integer values 2, 3, or 4. If you need a custom resolution (e.g., 1.5x or 5x), you must first apply the xbr filter to get close to your target, and then chain it with the standard scale filter using the neighbor flag to prevent blurring.
  • Performance: Higher scaling factors (like 4) require significantly more processing power and will increase encoding times.