Change Video Resolution to 1080p with FFmpeg
This article provides a straightforward guide on how to change a video’s resolution to Full HD (1080p) using FFmpeg on the Linux command line. You will learn the basic command to scale your videos, how to maintain the correct aspect ratio to prevent stretching, and how to optimize the output quality. Whether you are downscaling 4K footage or standardizing a video file, these command-line techniques will help you achieve clean results quickly.
The Basic 1080p Scaling Command
To resize a video to exactly 1920x1080 pixels, you use the FFmpeg
-vf (video filter) flag paired with the scale
filter. This method forces the video into a 1080p canvas regardless of
its original dimensions.
Here is the fundamental command structure:
ffmpeg -i input.mp4 -vf scale=1920:1080 output.mp4In this command, -i input.mp4 specifies your source
video, -vf scale=1920:1080 sets the new width and height,
and output.mp4 is the name of your resized file.
Maintaining the Aspect Ratio
Forcing a strict 1920x1080 resolution on a video that isn’t already in a 16:9 widescreen format will cause the image to look stretched or squished. To prevent this, you can tell FFmpeg to look at your desired width or height and automatically calculate the other dimension to preserve the original aspect ratio.
Fix Width, Auto-Scale Height
If you want the width to be exactly 1920 pixels and let the height
adjust automatically, use -1 for the height parameter:
ffmpeg -i input.mp4 -vf scale=1920:-1 output.mp4Fix Height, Auto-Scale Width (Recommended for 1080p)
Since “1080p” strictly refers to a vertical resolution of 1080 pixels, it is usually safer to lock the height at 1080 and let the width scale automatically:
ffmpeg -i input.mp4 -vf scale=-1:1080 output.mp4Ensuring Division by Two
(The -2 Trick)
Many modern video codecs (like H.264) require the width and height
dimensions to be even numbers. If the aspect ratio calculation results
in an odd number, FFmpeg will throw an error. To avoid this, use
-2 instead of -1. This tells FFmpeg to
automatically calculate the size but round it to the nearest even
number.
ffmpeg -i input.mp4 -vf scale=-2:1080 output.mp4Optimizing Quality and Speed
When you change the resolution of a video, FFmpeg re-encodes the
file. You can control the balance between processing speed, file size,
and visual quality by adding video codec and Constant Rate Factor
(-crf) flags.
Recommended H.264 Quality Command
ffmpeg -i input.mp4 -vf scale=-2:1080 -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4Parameter Breakdown
-c:v libx264: Encodes the video using the widely compatible H.264 codec.-crf 23: Controls the quality. The CRF scale typically ranges from 0 to 51. Lower values mean better quality but larger files. A value between 18 and 28 is the sweet spot for 1080p distribution.-preset medium: Controls the encoding speed-to-compression ratio. Options range fromultrafasttoveryvery缓慢.mediumis the default balanced option.-c:a copy: Copies the original audio stream directly without re-encoding it, saving processing time and preserving original audio quality.