Skip to content

Convert video to different resolutions with FFmpeg

Converting videos to different resolutions is a common task for anyone working with digital video content. Whether you're a content creator, video editor, or a developer working on video applications, understanding how to adjust video resolutions can help you optimize videos for different devices, platforms, and viewing experiences. This guide will walk you through various methods of changing video resolutions using FFmpeg.

If you're looking for somewhere to host and stream your videos for you, Mux's Video API has everything you need to manage video for your application.

Check out Mux's Video API!

LinkReasons for converting your video to different resolutions

There are several reasons why you might want to convert video to different resolutions:

  1. Device compatibility: Ensure videos play smoothly on devices with different screen sizes and capabilities.
  2. Bandwidth optimization: Lower resolutions require less bandwidth, improving streaming performance on slower connections.
  3. Storage management: Reduce file sizes for more efficient storage and faster uploads.
  4. Platform requirements: Meet specific resolution guidelines set by social media or video sharing platforms.
  5. Adaptive streaming: Create multiple resolution versions for adaptive bitrate streaming.
  6. Quality improvement: Upscale lower resolution footage for use in higher resolution projects.

Let's explore how to use FFmpeg to convert videos to different resolutions in various scenarios.

LinkBasic resolution conversion

The simplest way to change the resolution of a video is to use FFmpeg's scale filter:

bash
ffmpeg -i input_video.mp4 \ -vf "scale=1280:720" \ -c:a copy \ output.mp4

Breakdown of the command:

  • -i input_video.mp4: Specifies the input video file
  • -vf "scale=1280:720": Applies the scale filter to resize the video to 1280x720 pixels
  • -c:a copy: Copies the media streams without re-encoding
  • output.mp4: Name of the output file

This command will produce a video with a resolution of 1280x720 (720p), which is suitable for many web streaming scenarios.

LinkMaintaining aspect ratio

To maintain the original aspect ratio while changing resolution:

bash
ffmpeg -i input_video.mp4 \ -vf "scale=1280:-1" \ -c:a copy \ output.mp4

Here, -1 tells FFmpeg to automatically calculate the height while maintaining the aspect ratio after sizing to the new width.

LinkConverting to common resolutions

Here are commands for converting to some common resolutions, they all specify h264 for the output video codec:

Link4K (3840x2160)

bash
ffmpeg -i input_video.mp4 \ -vf "scale=3840:2160" \ -c:v libx264 -crf 23 \ -c:a copy \ output_4k.mp4

Link1080p (1920x1080)

bash
ffmpeg -i input_video.mp4 \ -vf "scale=1920:1080" \ -c:v libx264 -crf 23 \ -c:a copy \ output_1080p.mp4

Link720p (1280x720)

bash
ffmpeg -i input_video.mp4 \ -vf "scale=1280:720" \ -c:v libx264 -crf 23 \ -c:a copy \ output_720p.mp4

Link480p (854x480)

bash
ffmpeg -i input_video.mp4 \ -vf "scale=854:480" \ -c:v libx264 -crf 23 \ -c:a copy \ output_480p.mp4

LinkAdvanced resolution conversion techniques

LinkUpscaling with enhanced quality

For better quality when upscaling, you can use more advanced scaling algorithms:

bash
ffmpeg -i input_video.mp4 \ -vf "scale=3840:2160:flags=lanczos" \ -c:v libx264 -crf 18 \ -c:a copy \ output_4k_enhanced.mp4

This uses the Lanczos scaling algorithm, which can provide better results for upscaling.

LinkCreating multiple resolutions for adaptive streaming

To create multiple resolutions for adaptive streaming see the guide on converting mp4 to HLS.

LinkChoosing the right resolution conversion method

Different resolution conversion techniques have various benefits and drawbacks:

Simple scaling:

  • Benefits:
    • Fast and straightforward
    • Suitable for most basic needs
  • Drawbacks:
    • May not provide the best quality for significant resolution changes

Advanced scaling algorithms:

  • Benefits:
    • Better quality, especially for upscaling
    • Reduces artifacts and maintains sharpness
  • Drawbacks:
    • Slower processing time
    • May require more experimentation to find optimal settings

Multiple resolution encoding:

  • Benefits:
    • Prepares videos for adaptive streaming
    • Provides options for various playback scenarios
  • Drawbacks:
    • More complex to set up
    • Requires more storage space for multiple versions

LinkMux tips for effective resolution conversion

  • Consider your target devices: Research common screen resolutions for your target audience's devices.
  • Balance quality and file size: Higher resolutions mean larger file sizes; find the right balance for your needs.
  • Use appropriate codecs: Modern codecs like H.264 or VP9 can provide better quality at various resolutions.
  • Test thoroughly: Always test your converted videos on different devices and screen sizes.
  • Mind the aspect ratio: Be cautious when changing aspect ratios, as this can distort the image.
  • Adjust bitrate accordingly: Higher resolutions typically require higher bitrates to maintain quality.
  • Consider the source material: The quality of your output is limited by the quality of your input video.

I'll add "Mux" to a headline and create an FAQ section for this video resolution conversion article.

Looking for a "Tips" section... I see there's "Tips for effective resolution conversion" which should become:

"Mux tips for effective resolution conversion"

The article also doesn't have an FAQ section, so I'll create one:

LinkVideo resolution conversion FAQs

Can I upscale low-resolution video to 4K and improve quality?

Upscaling adds pixels through interpolation but can't add detail that wasn't in the source. A 480p video upscaled to 4K will look slightly smoother but fundamentally no sharper—you're just spreading the same information across more pixels. Use advanced scaling algorithms like Lanczos (scale=3840:2160:flags=lanczos) for best upscaling results, but manage expectations. Upscaling works better for moderate increases (720p to 1080p) than dramatic ones (480p to 4K).

What happens to aspect ratio when I change resolution?

If you specify both width and height explicitly (like scale=1280:720), FFmpeg will stretch or squash the video to fit, potentially distorting it. Use scale=1280:-1 to set width and auto-calculate height, or scale=-1:720 to set height and auto-calculate width. This maintains the original aspect ratio. For letterboxing or pillarboxing to force a specific aspect ratio without distortion, use the pad filter.

Should I convert to different resolutions before uploading or let the platform handle it?

Modern video platforms and APIs automatically generate multiple resolutions (adaptive bitrate ladders) when you upload. Converting beforehand adds unnecessary work unless you need specific control. Upload the highest quality source you have—platforms like Mux, YouTube, and Vimeo handle multi-resolution encoding optimally. Pre-converting only makes sense if you're hosting files yourself without transcoding infrastructure.

What bitrate should I use when changing resolution?

Roughly, use 4-6 Mbps for 1080p, 2-4 Mbps for 720p, and 1-2 Mbps for 480p as starting points for H.264. Scale proportionally—if going from 1080p at 5 Mbps to 720p, use about 2.5 Mbps. However, bitrate also depends on content complexity and codec. Use CRF mode (-crf 23) instead of targeting specific bitrates to let FFmpeg optimize based on content.

Why does my converted video look worse than the original?

Common causes: using too low a bitrate for the target resolution, not specifying a codec (FFmpeg may choose poorly), or re-encoding already compressed video (generation loss). Always use appropriate encoding settings: -c:v libx264 -crf 23 -preset medium provides good quality. If the source is already compressed at low bitrate, no amount of resolution conversion will improve visible quality.

Can I change resolution without re-encoding?

No. Resolution is determined during encoding—changing it requires decoding the source, scaling, and re-encoding. There's no "stream copy" option for resolution changes like there is for format conversions. Every resolution change involves full re-encoding, which takes time and may introduce quality loss if not configured properly.

How do I convert vertical video (9:16) to horizontal (16:9) without cropping?

You can't change aspect ratio without either cropping content or adding letterboxing. To add letterboxing: scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2 scales the video to fit within 1920x1080 while maintaining aspect ratio, then adds black bars to fill the frame. Alternatively, crop the original or accept the native vertical format.

What's the fastest way to batch convert multiple videos to different resolutions?

Write a shell script that loops through files: for file in *.mp4; do ffmpeg -i "$file" -vf "scale=1280:-1" -c:v libx264 -crf 23 "720p_$file"; done converts all MP4s to 720p. For production environments processing many files at scale, video APIs handle multi-resolution encoding automatically—you upload once and get all resolutions generated without managing FFmpeg yourself.

Arrow RightBack to Articles

No credit card required to start using Mux.