FFmpeg Cookbook
JA

Video Compressor

Shrink a video with H.264 in your browser. Choose "Quality (CRF)" to set the picture quality, or "Target Size (MB)" to set the file size.

Your file is not uploaded
Drag & drop a video, or tap to select
MP4 / MOV / AVI / MKV / WebM · Up to 500 MB
—
—
High
CRF 18
Large file · best quality
Standard
CRF 23
Balanced quality & size
Light
CRF 30
Smaller size priority
Fine CRF (18–35, lower = better quality) CRF 23

Processing… 0%
Original
—
MB
→
Compressed
—
MB
—% saved
Quality comparison
Original
Compressed
Download compressed video

Equivalent FFmpeg command

CLI command for your current settings. Updates live as you change controls.

ffmpeg -y -i input.mp4 -map 0:v:0 -map "0:a:0?" -pix_fmt yuv420p -map_metadata -1 -map_metadata:s -1 -map_chapters -1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -crf 23 -preset fast -c:a aac -b:a 128k -movflags +faststart output.mp4

What changes when you compress a video?

One 10-second clip compressed with three settings. The pictures show part of the frame at 2x.

Source 23.28 MB → 0.73 MB, encoded in 1.1 s
ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:0? -c:v libx264 -crf 36 -preset fast -pix_fmt yuv420p -c:a aac -b:a 96k -movflags +faststart output.mp4
Part of the original frame (a printed T-shirt and a jacket) at 2x The same part after compression at the selected setting Original Compressed
How this was measured

2026-09-24, FFmpeg 8.1 on Windows (H.264, fast preset), one run per setting on a 10-second 1080p live-action clip. The pictures are a 480x270 native-resolution crop at 3 seconds, shown at 2x.

Measurements (JSON)Source film

Tears of Steel (CC) Blender Foundation | mango.blender.org, CC BY 3.0. Cropped from the 4K version and scaled to 1080p; part of each encoded frame at 2x

Popular uses
Discord and email size limitsPre-upload compressionSmaller MP4 with acceptable quality

How to use

  1. Drop a videoMP4 / MOV / MKV / WebM up to 500MB. Drag-and-drop or tap to pick.
  2. Pick a modeChoose "Quality (CRF)" to put quality first, or "Target Size (MB)" to set the file size.
  3. Adjust resolutionKeep the original or downscale. Going from 1080 → 720 roughly halves the file.
  4. CompressWhen the progress bar finishes, a preview and a download button appear.

Recommended settings

Pre-upload to YouTube
CRF 20–23, original res, preset fast
YouTube encodes the upload again, so keep some quality in reserve.
A size-limited upload
Enter the destination's size limit
Check the limit in the destination's help pages. For long clips, trim or reduce resolution, then check the actual size and look.
Phone clip for social
CRF 23–26, 1080p
A higher CRF makes the file smaller. Check the look in the preview.
Archival quality
CRF 18–20, preset slow
A lower CRF keeps more detail, and the slow preset adds a little quality.

When it goes wrong

File size barely changes

Cause: The source is already well compressed.

Fix: Drop one resolution tier (1080 → 720) or push CRF above 28.

Quality looks awful

Cause: CRF above 30, or target MB too low for the duration.

Fix: Lower CRF back to 23–26, raise target MB, or trim the clip.

Browser freezes

Cause: Phones can run out of memory with files over 200 MB.

Fix: Lower the resolution or try a shorter clip. You can also use a computer.

Questions

How do I avoid noticeable quality loss?

Use about CRF 20 and keep the original resolution. At CRF 18 the loss is very hard to see, but the file is larger.

Can I strip the audio?

No. If the video has sound, the output keeps it. To remove the sound, use the Mute Video Tool, or add `-an` in FFmpeg.

Does iPhone HEVC (.mov) work?

Yes. It reads HEVC and writes H.264 in an MP4, which plays on more devices. HDR video is not converted to SDR.

How long can the input be?

The limit is 500 MB. The browser works in memory, so large files fail more often (phones show a warning above 200 MB). Trim long videos first, or use FFmpeg on a computer.

Why does the same CRF give different sizes for different videos?

CRF is a quality target, not a bitrate. Videos with more motion and fine detail need more data.

Can I output WebM or MOV?

No, this tool only outputs MP4 (H.264 + AAC). Use the Format Converter for other formats.

CRF or target MB?

Use CRF when quality matters and size is flexible. Use target MB for a size-limited upload: take the destination's limit and subtract any other attachments. Longer clips leave less bitrate for each second of video.

What does the encode preset (ultrafast / fast / slow) actually do?

It sets how much time the encoder spends. Slower presets take longer and raise quality a little, but at the same CRF they do not reliably make the file smaller. ultrafast is quick but makes the file much larger. If unsure, keep the default, fast.

My iPhone won't play the output

The output is H.264 (8-bit 4:2:0) with AAC audio in an MP4, a format iPhone plays. If it still will not play, try another clip to see whether the problem is the source file.

Output ended up larger than the original — why?

This happens when the source is already heavily compressed and you pick a low CRF (high quality). The result then shows "% larger". Raise the CRF or lower the resolution.

More detail (settings, limits, FFmpeg commands)

What each setting means

CRF
Constant Rate Factor (a quality target). Lower means higher quality and a bigger file. 18–28 is the usual range.
Target MB
The size you want. The video bitrate is worked out from the duration and the audio bitrate. When the clip is short for the target, the video bitrate is held at a cap for the output size, so the file comes out smaller than the target.
Resolution
Pixels on the short side: the height of a landscape video, the width of a portrait one. Going 1080 → 720 roughly halves the file size. A value larger than the source does not enlarge the video; it keeps its size (rounded to an even width and height).
Encode speed
The x264 preset. Slower presets take longer and raise quality a little. At the same CRF they do not reliably make the file smaller, and ultrafast makes it much larger.

Browsers and limits

  • Modern Chrome / Edge / Firefox / Safari
  • Up to 500 MB (phones show a warning above 200 MB)
  • Output is MP4 (H.264 + AAC) only

The same job with the FFmpeg command line

Standard CRF 23 compression
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset fast -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart output.mp4
The same quality settings as the tool default (Standard, CRF 23, fast). -pix_fmt yuv420p writes 8-bit 4:2:0, which most devices play.
Downscale to 720p with CRF
ffmpeg -i input.mp4 -vf "scale='if(gte(iw,ih),-2,trunc(min(min(iw,ih),720)/2)*2)':'if(gte(iw,ih),trunc(min(min(iw,ih),720)/2)*2,-2)'" -c:v libx264 -crf 23 -preset fast -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart output.mp4
Sets the short side to 720: landscape becomes 1280x720, portrait 720x1280 (scale=-2:720 would make a portrait clip 406x720). A video whose short side is under 720 is not enlarged. This is the same filter the tool uses.
Aim for 10 MB (60 s clip)
ffmpeg -i input.mp4 -c:v libx264 -b:v 1138k -maxrate 1252k -bufsize 2276k -preset fast -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart output.mp4
The tool's own math: floor(10,000,000 × 0.95 × 8 / 60 / 1000) = 1266, minus 128 kbps of audio = 1138 kbps. It does not guarantee the file fits.

CRF vs target-MB: when to pick which

CRF (Constant Rate Factor) puts steady quality first. The encoder spends more data on busy, moving scenes and less on still ones, so the final size depends on the content and cannot be fixed in advance. It suits destinations where size does not matter much, such as YouTube.

Target Size (MB) counts 1 MB as 1,000,000 bytes. The total bitrate is floor(target_MB × 8000 × 0.95 / duration_seconds); the audio (128 kbps, or 64 kbps for clips over 300 seconds) is subtracted and the rest goes to the video. The 5% reserve covers the container and similar overhead; it is not a size guarantee. If the output is over the target, the tool lowers the bitrate and encodes once more. If it is still over, it says so. Trim the clip or lower the resolution.

When the clip is short for the target, the video bitrate is held at a cap for the output size and the file comes out smaller than the target. The caps are the recommended upload bitrates in YouTube Help (SDR, 48–60 fps): 1500 kbps up to 360p, 4000 up to 480p, 7500 up to 720p, 12000 up to 1080p, 24000 up to 1440p and 68000 up to 2160p (checked 2026-09-25). With these caps even 1080p60 stays within H.264 level 4.2.

x264 preset vs encode time

libx264 presets run from ultrafast through veryfast, fast, medium and slow to veryslow. Slower presets take longer and raise quality a little. At the same CRF they do not reliably make the file smaller, and ultrafast makes it much larger. This tool offers ultrafast, fast, medium and slow; the default is fast.

To spend more time on quality, copy the command from the 'Equivalent FFmpeg command' box on this page, change `-preset` to `slow` or slower, and run it with FFmpeg on your computer.

Why this tool outputs H.264, not HEVC or AV1

H.264 plays in more places than any other format: the built-in apps on Windows, macOS, iPhone and Android, the main browsers, and most software such as PowerPoint. HEVC (H.265) and AV1 can make smaller files at the same quality, but HEVC may need a paid extension from the Microsoft Store on Windows, and AV1 does not play on some older devices and apps.

For your own archive, HEVC or AV1 can save space. When you send a video to others, or do not know where it will be played, an MP4 with H.264 and AAC is the safest choice.

What to do next