FFMPEG
ToolsConverterBlogAboutContact
Home / Blog / How to Compress a Video Without Losing Quality (Or While Pretending To)

8 min read · March 10, 2026 · Updated May 28, 2026

How to Compress a Video Without Losing Quality (Or While Pretending To)

A practical, opinionated guide to compressing video files. What "lossless" actually means, when to use CRF, how to pick a bitrate, and the trade-offs.

"Without losing quality" is a marketing phrase

Before we get to the practical advice, it is worth being honest about the title. Almost every guide on this topic promises compression "without losing quality," and almost every one of them is lying, because compression and quality are inversely related by definition. You can have one or the other; you can balance them; you cannot eliminate the trade.

What you can do is get the trade-off down to a level where the loss is genuinely invisible. A modern H.264 or H.265 encoder, given enough bits and a reasonable preset, will produce output that is indistinguishable from the source on any consumer screen. That is what most people mean when they say "without losing quality" — not literally lossless, but visually indistinguishable.

There is also a true lossless option, which I will get to last. For most purposes, you do not want it.

The four levers, ranked by impact

When you compress a video, you have four main controls. In order of how much each one affects file size:

Resolution. A 4K video is roughly four times the data of a 1080p video, and a 1080p video is roughly four times the data of a 540p one. Halving the resolution along both axes reduces the file size by about seventy-five percent. This is the single most powerful lever.

Codec. H.265 produces files roughly forty percent smaller than H.264 at the same visual quality. AV1 is another fifteen to twenty percent better than H.265. The trade-off is encoding time (slower for newer codecs) and compatibility (older devices may not play newer codecs).

Bitrate or quality target. Within a given codec, bitrate is what you are actually adjusting. You can set it directly (give me 2 megabits per second), or you can target a quality level and let the encoder pick the bitrate to hit it. The latter is almost always what you want.

Audio settings. Audio is usually a small fraction of total file size, but if you have a multi-language file with five audio tracks, the math changes. Dropping unused tracks is a cheap win.

The right way to compress: CRF

The single most useful FFmpeg flag for compression is -crf, which stands for Constant Rate Factor. CRF tells the encoder to target a specific quality level, varying the bitrate as needed to maintain it. Calm scenes get fewer bits, complex scenes get more, and the result is consistent perceived quality across the whole video.

For H.264, CRF runs from 0 (lossless) to 51 (terrible). The useful range is roughly:

  • CRF 18 — visually lossless. You cannot tell it apart from the source on any screen. File size will be larger than the source if your source was already heavily compressed, smaller if your source was high-bitrate.
  • CRF 23 — the default. Excellent quality, moderate file size. A good starting point for almost any compression task.
  • CRF 28 — noticeably compressed if you look closely, but fine for casual viewing. File size is roughly half of CRF 23.
  • CRF 32 and above — visible artifacts. Use only when file size is more important than how the video looks.

For H.265, the equivalent CRF values are roughly five higher (CRF 23 in H.264 is comparable to CRF 28 in H.265). For AV1 the scale is different again; check the encoder's documentation.

The FFmpeg invocation looks like this:

``

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset slow -c:a aac -b:a 128k output.mp4

`

A few notes on that command: -preset slow tells the encoder to spend more time compressing in exchange for a smaller file. -c:a aac -b:a 128k re-encodes audio at 128 kilobits per second, which is fine for stereo. If your source already has reasonable audio, you can replace those flags with -c:a copy to leave it untouched.

You can run this exact command in your browser using the advanced field in our free converter — paste the arguments, drop the file, watch the log.

When to drop the resolution

If your source is 4K and the file is going to be viewed on phones, just downscale it. There is no perceptual reason to ship 4K to a 6-inch screen, and the file will be a quarter of the size. The FFmpeg flag is -vf scale=1280:-2 for 720p or -vf scale=1920:-2 for 1080p. The -2 keeps the aspect ratio and ensures the height is even (H.264 requires even dimensions).

Combined with a CRF target:

`

ffmpeg -i input.mp4 -c:v libx264 -vf scale=1920:-2 -crf 23 -preset slow -c:a aac -b:a 128k output.mp4

`

For most "compress this for email" or "compress this for messaging" tasks, dropping to 1080p and CRF 23 will get you a tenfold size reduction with no visible loss.

When to use H.265 instead of H.264

H.265 is the right choice when:

  • The output will be viewed on devices that definitely support it (any iPhone from the last five years, modern Android, modern smart TVs).
  • You care more about file size than encoding time.
  • You are storing the file long-term rather than shipping it to an unknown audience.

H.265 is the wrong choice when:

  • You are uploading to a platform that will re-encode the file anyway (YouTube, Instagram). Save the encoding time.
  • You are embedding the video on a website that needs broad browser support.
  • The recipient might be using older hardware.

The FFmpeg encoder for H.265 is libx265, and the CRF scale runs about five points higher than H.264 — CRF 28 in libx265 is comparable to CRF 23 in libx264.

Targeting a specific file size

Sometimes you do not care about quality in the abstract; you care that the file is under twenty-five megabytes because Discord said so. In that case, you want to target a bitrate, not a quality level.

The math is straightforward: file size (in megabits) equals bitrate (in megabits per second) times duration (in seconds). To hit a target size, calculate the total available bitrate, subtract a reasonable amount for audio (128 kilobits per second, say), and use the rest for video.

For a 60-second clip targeting 25 megabytes (200 megabits), that is 200 / 60 ≈ 3.3 megabits per second total, or about 3.2 Mbps for video after audio.

`

ffmpeg -i input.mp4 -c:v libx264 -b:v 3.2M -maxrate 3.5M -bufsize 6M -c:a aac -b:a 128k output.mp4

`

For longer videos or more reliable size targeting, do a two-pass encode. That is more advanced and rarely necessary for short clips.

True lossless compression

If you actually need bit-perfect lossless compression — for archival of source footage, or a video that will be re-encoded later — use a lossless codec. FFmpeg supports several. The most common is FFV1, which compresses losslessly and is widely supported in professional workflows:

`

ffmpeg -i input.mp4 -c:v ffv1 -c:a flac output.mkv

`

Lossless H.264 also exists (-crf 0`), but produces files so large you might as well not bother.

The catch with true lossless compression is that "small" is not on the menu. Lossless files are typically two to five times larger than the original lossy file, sometimes more. You are not compressing in the everyday sense; you are losslessly re-packing, possibly with some modest savings from a better algorithm. Do this when you need it. Do not do it as a default.

Doing it in the browser

All of the above works in the browser-based FFmpeg converter on this site. Drop the file, open advanced settings, paste an argument string, and watch the conversion happen locally. Nothing uploads. If you are coming from desktop FFmpeg, the only difference is that the tool exposes the same encoders through a browser tab instead of a terminal.

For more on browser vs desktop FFmpeg, see Convert video in browser vs desktop. For a deeper codec primer, see H.264 vs H.265 vs AV1.

Ready to convert your video?

Use the Free FFmpeg Converter →

// Navigate

ConverterAll ToolsBlog

// Tools

MP4 ConverterCompress for WhatsAppMOV → MP4Video → GIF

// About

AboutContactPrivacyTerms

© 2026 FFMPEG CONVERTER

POWERED BY FFMPEG WEBASSEMBLY