Mastering FFmpeg: How to Drastically Reduce Video Size Without Losing Quality

UNYIME ETIM

Nov 26, 2025

1 min read
Mastering FFmpeg: How to Drastically Reduce Video Size Without Losing Quality

In today's digital world, video content is king. From social media feeds to professional websites, high-quality video is essential for engaging audiences. But high quality often means large file sizes, which can lead to slow loading times, expensive storage, and high bandwidth costs. Fortunately, there's a powerful, free, and open-source tool that can solve this problem: FFmpeg.

This comprehensive guide will walk you through several effective techniques to reduce video size using FFmpeg, helping you optimize your content for the web and beyond without a noticeable drop in quality.

What is FFmpeg?

FFmpeg is a complete, cross-platform solution to record, convert, and stream audio and video. It's a command-line tool, which might seem intimidating at first, but its power and versatility are unmatched. Developers and video professionals use it to handle almost any multimedia task imaginable, and video compression is one of its most popular uses.

The Core Concepts: Codecs and Quality

Before diving into the commands, it's helpful to understand two key concepts:

  • Codecs: A codec is an algorithm used to compress and decompress video data. The most common codec is H.264 (libx264), known for its wide compatibility. A more modern and efficient codec is H.265 (libx265 or HEVC), which can offer up to 50% better compression than H.264 at the same level of visual quality.
  • Quality vs. Size: Video compression is always a trade-off between file size and visual quality. The goal is to find the sweet spot where the file size is significantly smaller, but the quality is still acceptable for your needs.

Method 1: The Best All-Around Technique - Using Constant Rate Factor (CRF)

The most effective way to control video quality and file size is by using the Constant Rate Factor (CRF). Instead of telling FFmpeg to target a specific bitrate, CRF targets a specific level of perceptual quality. This is the recommended method for most use cases.

The CRF scale for the H.264 (libx264) encoder is 0-51:

  • 0: Lossless (extremely large file size)
  • 23: The default value, a good starting point.
  • 17-18: Often considered visually lossless or nearly so.
  • 18-28: A sane and effective range for balancing quality and size.
  • 51: Worst possible quality.

A lower CRF value results in higher quality and a larger file, while a higher value gives you a smaller file with more compression.

Basic Compression with H.264:

Here is the fundamental command to compress a video using H.264 with a CRF of 23:

ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4

Command Breakdown:

  • -i input.mp4: Specifies the input file.
  • -c:v libx264: Sets the video codec to H.264.
  • -crf 23: Sets the Constant Rate Factor to 23.
  • output.mp4: Defines the name of the new, compressed file.

Method 2: Boost Efficiency with a Modern Codec (H.265/HEVC)

For even greater file size reduction, you can use the H.265 (HEVC) codec. It's particularly effective for higher-resolution videos like 1080p and 4K. Keep in mind that while support is widespread on modern devices, it's not as universal as H.264.

The recommended CRF values for H.265 are slightly different. A CRF of 28 in H.265 is roughly equivalent to a CRF of 23 in H.264.

Compression with H.265:

ffmpeg -i input.mp4 -c:v libx265 -crf 28 output.mp4

This command can dramatically reduce file size, often by 25-50% compared to an H.264 encode of similar quality.

Method 3: Reduce Resolution (Resizing)

If your source video has a very high resolution (like 4K) but will be viewed on smaller screens, reducing the resolution is a highly effective way to cut down the file size.

You can use the -vf scale filter to resize the video. A great feature is the ability to set either the width or height and have FFmpeg automatically calculate the other dimension to maintain the aspect ratio.

Resizing to 1080p (1920px wide):

ffmpeg -i input.mp4 -vf "scale=1920:-2" output.mp4

Command Breakdown:

  • -vf "scale=1920:-2": This is a video filter (vf) that scales the video.
  • 1920: Sets the new width to 1920 pixels.
  • -2: Tells FFmpeg to automatically calculate the height to match the original aspect ratio, ensuring the value is divisible by 2 (which helps with compatibility).

You can combine this with CRF for even better results:

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -vf "scale=1920:-2" output.mp4

Method 4: Strip the Audio Stream

If the video doesn't require sound (for example, a decorative background video), you can remove the audio track entirely for extra savings. The -an flag tells FFmpeg to discard all audio streams.

Removing Audio:

ffmpeg -i input.mp4 -c:v copy -an output.mp4

In this command, -c:v copy tells FFmpeg to copy the video stream without re-encoding it, which makes the process extremely fast. If you want to compress the video and remove the audio simultaneously, you can combine it with other methods:

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -an output.mp4

Putting It All Together: A Powerful Combination

For maximum compression, you can combine these techniques into a single command. Let's say you want to convert a 4K video to a highly optimized 1080p file using the H.265 codec:

ffmpeg -i input_4k.mp4 -c:v libx265 -crf 28 -vf "scale=1920:-2" -c:a aac -b:a 128k output_1080p.mp4

Here, we've also specified the audio encoding (-c:a aac -b:a 128k), which sets the audio codec to AAC with a bitrate of 128kbps—a standard for web video.

FFmpeg is the Swiss Army knife of video manipulation. Mastering a few key commands can revolutionize your workflow, saving you time, storage, and money.

While FFmpeg offers unparalleled control, we understand that not everyone wants to live in the command line. If you're looking for a simpler, faster way to create and manage professional videos, a dedicated platform can be a game-changer.

Ready to create amazing videos? Try our easy-to-use AI-powered video creation platform, Eelclip. Start with a generous free trial and enjoy our risk-free 30-day money-back guarantee. Signup at https://eelclip.com/account/register

Share this article

Help others discover this content

Read More

Explore more articles you might find interesting

Mastering the FFmpeg Zoom Effect: A Guide to Dynamic Video Editing

Mastering the FFmpeg Zoom Effect: A Guide to Dynamic Video Editing

Nov 26
1 min
Unlocking Creativity: A Deep Dive into What Are Stable Diffusion Models?

Unlocking Creativity: A Deep Dive into What Are Stable Diffusion Models?

Nov 26
1 min
What Large Language Models Are: A Complete Guide to the AI Revolution

What Large Language Models Are: A Complete Guide to the AI Revolution

Nov 24
5 min