How to Compress Large Video Files Using FFmpeg on Windows

Compressing large video files with FFmpeg is a trade between size and quality, and you need to know which side you are making. A phone clip at 4K and 60 frames a second can reach several gigabytes, yet much of that data goes into motion nobody watching on a laptop will notice. This guide covers both ways to shrink a file, constant rate factor for the best picture at a size and two pass encoding for an exact size.

Compression is a trade, so decide which one you are making

Work out what you are optimising for before you type anything. Constant rate factor, written CRF, sets a quality target and accepts whatever file size comes out of it. Two pass encoding measures the source in the first pass, then spends the bits in the second pass so the output lands on the size you chose.

Pick CRF for the smallest reasonable file at the quality you want. Pick two pass when an upload limit dictates the maximum size.

Read the source file before you compress anything

Compression settings only make sense against the file you start with. A 400 MB clip already at 720p and 30 frames a second has little left to give, while a 3 GB 4K recording has plenty. FFprobe reads it without changing it:

ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,width,height,r_frame_rate -of default=noprint_wrappers=1 "C:\Videos\clip.mp4"

You get the codec, the width, the height and the frame rate, and the frame rate arrives as a fraction, so 30/1 means 30 frames a second. File Explorer Properties gives you the byte count.

Compress video files with a constant rate factor

Here is the command most people end up running:

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

Each flag has one job.

A terminal window open next to a quality slider for choosing video compression
The CRF number is the slider you move. Everything else in the command stays put.

What each CRF number does to the file

CRF value What the result looks like Where it fits
18 Close to the source, hard to tell apart Masters and archiving
23 The default, solid quality at a sensible size Everyday sharing
28 Noticeably smaller, still clean on a screen The web, email and phone sharing
33 Visible softening and blocking in motion Last resort only

Run one file at CRF 23 and CRF 28 and compare them. If the difference is not obvious on your screen, take the smaller one.

Two video files side by side showing the file size before and after compression
The same clip at two CRF values, with the file size under each one.

Use the graphics card when speed matters more than pixels

Software encoding a long clip takes real time. The encoder in your graphics card is quicker:

ffmpeg -i input.mp4 -c:v h264_nvenc -preset p5 -cq 28 -c:a aac output.mp4

h264_nvenc is the NVIDIA encoder, and -preset p5 is its speed and quality ladder, where p1 is slowest and best. Intel Quick Sync uses -c:v h264_qsv and AMD uses -c:v h264_amf, with -global_quality instead of -cq on Intel.

There is a catch. A hardware encoder is less efficient, so the same number gives a softer picture or a bigger file. NVENC at CQ 28 is not the same image as libx264 at CRF 28, so use a lower number, around 24 to 26. The gain is speed.

If the encoder is missing, the card is too old or the driver is stale, and FFmpeg reports Unknown encoder 'h264_nvenc'. Run ffmpeg -encoders | findstr nvenc to see what your build supports.

A processor chip handling the video encoding while the file size drops
The same work happens on the graphics chip instead of the processor, and finishes sooner.

Scale a 4K source down to 1080p

Resolution is where the bytes are. A 3840 by 2160 frame carries four times the pixels of a 1920 by 1080 frame, so scaling down before encoding is the biggest saving:

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

The -2 tells FFmpeg to work out the height from the width and the aspect ratio, then round it to an even number. You cannot use -1 there, because the H.264 encoder refuses odd dimensions and stops with width not divisible by 2.

Remove the audio track when you do not need it

For a silent clip or a video that will carry captions, add -an to drop the audio stream instead of encoding it:

ffmpeg -i input.mp4 -an -c:v libx264 -crf 28 -preset slow output.mp4

You save a little space and avoid the drift that appears when a video and its audio fall out of sync. Keep the audio when the words matter, since 128 kbps AAC costs very little.

Cut a segment instead of re-encoding the whole file

You do not need to process a whole recording to keep three minutes of it. Put -ss before the input so FFmpeg seeks to the timestamp, and use -t to stop after a fixed length:

ffmpeg -ss 00:02:30 -i input.mp4 -t 00:03:00 -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 128k clip.mp4

With -ss before -i the seek is fast and lands on the right frame. Placing -ss after -i forces FFmpeg to decode everything up to that point, which wastes minutes.

Hit an exact file size with two pass encoding

When a number matters more than a picture, aim at a bitrate:

ffmpeg -i input.mp4 -c:v libx264 -b:v 1500k -pass 1 -passlogfile passlog -an -f null NUL
ffmpeg -i input.mp4 -c:v libx264 -b:v 1500k -pass 2 -passlogfile passlog -c:a aac -b:a 128k output.mp4

The first pass reads the whole file, writes a statistics log and throws the video away. NUL is the Windows null device, the same idea as /dev/null on Linux. The second pass reads that log and spends the bitrate where the picture needs it.

Both passes must use the same bitrate and the same -passlogfile name, or the second pass finds no data and the result is worse than a single pass. The log lands in the folder as passlog-0.log and passlog-0.log.mbtree.

Size follows bitrate and duration, so 1500 kbps across ten minutes lands near 112 MB. Two pass costs twice the encoding time, which is why CRF is the default unless a limit applies.

Most phone videos do not need 60 frames a second

Phone video is usually recorded at 1080p and 60 frames a second. For talking head footage, family clips and screen recordings you rarely need 60. Halving the frame rate removes half of the frame data, and the saving lands larger because the encoder gets more bits per frame.

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

Leave the frame rate alone for action footage or sport, because 30 frames a second turns quick motion into a blur. Twenty four frames a second looks like cinema in a film and worse than 30 in a home video.

Keep the output as MP4 with H.264 and AAC

Finish with an MP4 container holding H.264 video and AAC audio. That combination plays on Windows 10 and Windows 11, on phones, on smart televisions, in Chrome and Edge, and on major streaming platforms. A Matroska file with the same codecs is just as good, but upload forms refuse MKV.

HandBrake if you would rather use a window

HandBrake is free and open source and does the same job through a graphical interface. Open the file, pick a preset, and the quality control is a rate factor slider on the Summary tab. The idea is the same as CRF, so a value near 28 lands in the same place.

What you give up is finer control. Frame rate, scaling filters and two pass encoding are in HandBrake, but they sit behind more clicks.

Why we skip online video compressors

Online compressors work by uploading your file to a server that belongs to somebody else. A holiday video or a recording of a meeting leaves your machine, and there is no way of knowing how long it is kept or who can reach it. The free tiers also cap the file size and push the paid version at the download.

Every command here assumes FFmpeg is on your PATH. If Windows says 'ffmpeg' is not recognized as an internal or external command, the setup is the problem, not the compression. Our guide to fixing ffmpeg when it is not working covers each error, and the FFmpeg install walkthrough for Windows 11 shows the PATH step people skip.

If the video is only a soundtrack you care about, our guide to converting MP4 to MP3 for free covers the audio side. If you are freeing space rather than sharing a clip, our guide to finding large files taking up disk space points at what is worth deleting first, and our guide to batch renaming files in Windows handles the filenames.

Frequently asked questions

What is the best CRF value for smaller files?

Use 28 for web and phone sharing. It is visibly softer than the source but still clean on a screen, and it usually halves the file size.

Does hardware encoding reduce quality?

Yes, at the same number. NVENC at CQ 28 looks softer than libx264 at CRF 28, so drop to about 24 or 26 to get close.

How do I compress a video to a specific file size?

Use two pass encoding with a bitrate in the first pass and the same bitrate and log file name in the second. The output lands close to the target.

Why use -2 instead of -1 when scaling down?

Because -2 rounds the height to an even number. The H.264 encoder refuses odd dimensions and stops with a width not divisible by 2 error.

Can I compress a video without installing anything?

HandBrake does the same job in a window using a rate factor slider. Online compressors work too, but they upload your video to someone else's server.

What to remember

Open a terminal, run the CRF command on one file and compare the result with the original. If the source is 4K, add the scale filter and drop the frame rate to 30 first, because those changes usually save more than the CRF value.