FFmpeg Cookbook

Video Compressor

Free in-browser tool to shrink videos with H.264. Choose between CRF (quality-first) or target-MB (size-first) modes.

Fully local processing — your file never leaves the browser
🎬
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.

Pick a file and adjust settings — the command appears here.

Visual concept

Original50 MB1080p · CRF 23CRF 28+ 720pAfter8 MB720pSaved−84%

* Actual results depend on source duration / complexity (illustrative example)

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

What this tool does

  • Pick CRF 18–35 for fine-grained quality control
  • Hit Discord / email / Slack size caps with automatic bitrate math
  • Downscale to 1080p / 720p / 540p with one click
  • Side-by-side Before / After preview
  • Local processing — your file never leaves the browser

How to use

  1. 1

    Drop a video

    MP4 / MOV / MKV / WebM up to 500MB. Drag-and-drop or tap to pick.

  2. 2

    Pick a mode

    Choose "CRF" for quality-first, or "Target MB" for a fixed file size.

  3. 3

    Adjust resolution

    Keep the original or downscale. Going from 1080 → 720 roughly halves the file.

  4. 4

    Compress

    When the progress bar finishes you get a preview and a download button.

What each setting means

CRF
Constant Rate Factor. Lower = higher quality and bigger files. Typical range: 18–28.
Target MB
Desired output size. Bitrate is back-calculated from duration and audio.
Resolution
Vertical pixel count. Going 1080 → 720 roughly halves the file size.
Encode preset
fast = quicker but slightly larger file. slow = smaller file, slower encode.

Recommended settings

Pre-upload to YouTube
CRF 20–23, original res, preset fast
YouTube re-encodes anyway, so leave headroom.
Discord free tier (10MB)
Target 10MB, 720p or 540p
Long clips need a smaller resolution to keep bitrate sane.
Phone clip for social
CRF 23–26, 1080p
Higher CRF is hard to spot on small screens.
Archival quality
CRF 18–20, preset slow
Lower CRF + slow preset = best quality at given size.

Common pitfalls

Symptom: File size barely changes

Cause: Source is already H.264-compressed.

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

Symptom: 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.

Symptom: Browser freezes

Cause: Loading >200MB on mobile.

Fix: Downscale first, or run on a desktop browser.

Equivalent FFmpeg commands

Reference commands you can run on the desktop FFmpeg CLI.

Standard CRF 23 compression
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset fast -c:a aac -b:a 128k -movflags +faststart output.mp4
Downscale to 720p with CRF
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 23 -preset fast -c:a aac -b:a 128k -movflags +faststart output.mp4
Hit a 10MB cap (60s clip)
ffmpeg -i input.mp4 -c:v libx264 -b:v 1200k -maxrate 1320k -bufsize 2400k -c:a aac -b:a 128k -movflags +faststart output.mp4
bitrate ≈ targetMB × 8 / duration - audioKbps

Browser support & limits

  • Modern Chrome / Edge / Firefox / Safari
  • Up to 500MB (200MB on mobile)
  • Output is MP4 (H.264 + AAC) only

Privacy

This tool runs ffmpeg.wasm directly in your browser. Files never leave your device — everything runs locally. Read the privacy policy →

Frequently asked questions

How do I avoid noticeable quality loss?

Stick to CRF 20 and keep the original resolution. CRF 18 is virtually lossless visually but produces larger files.

Can I strip the audio?

No — this tool always keeps the audio track. Use ffmpeg -an or the volume tool if you need silent output.

Does iPhone HEVC (.mov) work?

Yes, the tool reads HEVC input and outputs H.264 (mp4) for maximum compatibility.

How long can the input be?

Roughly 30 minutes / 500MB before browsers run out of memory. Trim first or use desktop FFmpeg for longer clips.

Why does the same CRF give different sizes?

CRF targets a quality, not a bitrate. Complex scenes need more bits, so output size varies.

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" — which mode should I pick?

CRF if you want best quality and don't care about exact size. Target MB when you have a hard cap (Discord 10MB, mail 25MB, etc). Target MB drops bitrate as duration grows, so longer clips will look worse.

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

It trades encode time for compression efficiency. Slower presets give smaller files at the same quality, but multiply encode time. In a browser context, fast to medium is realistic — slow is rarely worth the wait.

My iPhone won't play the output

Rare. The tool outputs yuv420p H.264 (baseline-to-high profile) which iPhone supports natively. If playback still fails the file is likely corrupted — try compressing a different clip to confirm.

Output ended up larger than the original — why?

Happens when the source is already heavily compressed (e.g. an existing CRF-28 encode) and you ask for CRF 18. The encoder targets a higher quality than the source, inflating size. Pick a CRF closer to the source's implicit quality.

Related tools

Related FFmpeg recipes

In depth: context unique to this tool

CRF vs target-MB: when to pick which

CRF (Constant Rate Factor) prioritizes consistent quality. With CRF in the 18-23 range, the encoder allocates more bits to complex motion and fewer to near-still frames; the bitrate floats with the content, but visual quality stays uniform. File size becomes hard to predict in advance, which is fine when the destination has a generous size limit (your own storage, YouTube, a portfolio site). For 'quality first' delivery, CRF is the right mode.

Target-MB mode works more like ABR (Average Bit Rate): the encoder back-calculates `video_kbps = (target_MB × 8192 - audio_kbps × duration) / duration` and pins `-b:v` plus `-maxrate`. This is the mode you need when the destination enforces a strict cap — Discord 10 MB, Gmail 25 MB, Slack 1 GB. The tool applies a 0.92-0.98 safety factor internally to absorb container overhead so the output actually clears the cap instead of brushing against it.

x264 preset vs encode time

libx264 ships nine presets — ultrafast / superfast / veryfast / faster / fast / medium / slow / slower / veryslow — and slower presets cost exponentially more CPU for incremental quality gains at the same bitrate. The browser build of FFmpeg used here defaults to `veryfast` or `fast` so a 500 MB clip finishes in 30 seconds to 2 minutes; native desktop FFmpeg can squeeze more quality per byte at `slow` or `veryslow`, but the wait is much longer.

When quality really matters, copy the FFmpeg command shown in the 'Equivalent FFmpeg commands' section, swap the preset to `slow`, and run it locally. Use the WASM tool for single-file convenience, use desktop for batches and final-cut delivery.

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

The output is H.264 (libx264) for the same reason every browser, OS, and editor still treats it as the safe default: it plays everywhere. Windows / macOS / iOS / Android system players, Chrome / Safari / Edge / Firefox, Discord / Slack / X embed players, PowerPoint / Premiere / Final Cut imports — all reliably decode H.264. HEVC (H.265) and AV1 halve file size at the same quality, but they still hit playback edge cases (Windows needs the paid HEVC extension; AV1 trips up many NLEs).

For private archival, HEVC or AV1 is worth it. For 'I'm sending this somewhere and I don't fully control where it ends up', H.264 + AAC + MP4 is the lowest-risk combination. This tool is tuned for the second case.

What to do next