Email attachment limits are small and unforgiving: Gmail and Outlook.com both cap attachments at 25 MB, and many corporate or desktop Outlook setups are stricter still (often 10–20 MB). A phone video clears those limits in seconds. FFmpeg can shrink it to fit — sometimes with a single quality setting, sometimes by aiming at an exact target size with two-pass encoding. This guide walks through all three approaches and the math for picking a bitrate. Estimated time: 10 minutes.

Tested with: FFmpeg 8.1

This focuses on email caps specifically. For general size reduction see Compress Video; for Discord’s tiered limits see Discord Video Compression.


What You’ll Learn

  1. Common email attachment limits (Gmail, Outlook)
  2. The quick way: shrink by quality (CRF)
  3. Cutting size hard by downscaling resolution
  4. Two-pass encoding to hit an exact target size
  5. The formula that turns a size limit into a bitrate
  6. Troubleshooting
  7. FAQ

1. Email Attachment Limits

Aim a little under the limit — mail systems add encoding overhead (Base64 inflates an attachment by roughly 33% in transit), and you want margin.

ServiceAttachment limitSafe target
Gmail25 MB~18–20 MB
Outlook.com25 MB~18–20 MB
Yahoo Mail25 MB~18–20 MB
Corporate / desktop Outlook10–20 MB~8–12 MB

If your clip is far over the limit, expect to both lower quality and downscale resolution.


2. Quick Way — Shrink by Quality (CRF)

The fastest single-pass option: let FFmpeg pick the bitrate to hold a quality level. -crf 28 is aggressive enough for most short clips.

ffmpeg -i input.mp4 -vcodec libx264 -crf 28 -preset slow -acodec aac -b:a 96k output.mp4
  • -crf 28 … higher CRF = smaller file (lower quality)
  • -preset slow … squeezes more out of the bitrate; worth the extra time
  • -b:a 96k … trims audio to 96 kbps, plenty for voice/clips

Check the resulting size. If it is still over, raise CRF a few points or move to downscaling (Section 3).


3. Cut Size Hard — Downscale Resolution

Resolution is the biggest lever. Dropping a 1080p clip to 720p removes more than half the pixels, which slashes the bitrate needed for the same visual quality.

ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 28 -c:a aac output.mp4
  • -vf scale=-2:720 … set height to 720, auto-width keeping aspect ratio; -2 keeps the width an even number (required by H.264)

Go to scale=-2:480 for even smaller files when the footage doesn’t need detail. See Scale / Resize Video for more on the scale filter.


4. Two-Pass — Hit an Exact Target Size

When you must land just under a hard cap, target a bitrate with two-pass encoding. The first pass analyzes the video and writes a log; the second pass uses it to spend bits optimally. Run these as two separate commands, both on the same input.mp4.

Pass 1 (analysis only — no output file, audio dropped):

ffmpeg -y -i input.mp4 -c:v libx264 -b:v 1000k -pass 1 -an -f null -

Pass 2 (writes the final file using the pass-1 log):

ffmpeg -i input.mp4 -c:v libx264 -b:v 1000k -pass 2 -c:a aac -b:a 96k output.mp4
  • -pass 1 -an -f null - … analysis run; -an drops audio, -f null - discards output
  • -pass 2 … final encode constrained to the target video bitrate
  • -b:v 1000k … the video bitrate you chose from the formula below

For a deeper dive into how two-pass works, see Two-Pass Encoding.


5. Pick a Bitrate from the Size Limit

To target a size, convert your limit and clip length into a video bitrate. Subtract the audio bitrate, and keep ~10% headroom. The formula:

total_bitrate (kbps) = target_size_MB * 8192 / duration_seconds
video_bitrate (kbps) = total_bitrate - audio_bitrate (kbps)

(8192 = 8 bits/byte * 1024 KB/MB.) Then shave ~10% off the result for container overhead.

Worked example — a 60-second clip into a 15 MB Outlook-safe target with 96k audio:

total  = 15 * 8192 / 60      = ~2048 kbps
video  = 2048 - 96           = ~1952 kbps
with ~10% headroom           -> use -b:v 1700k

Plug that into the -b:v value in both passes of Section 4. If a clip is so long that the math gives a tiny bitrate (say under ~500 kbps), downscale resolution first (Section 3) so those bits go further.


6. Troubleshooting

File is still over the limit

Cause: CRF/bitrate too generous for the clip length. Fix: Raise CRF a few points, downscale resolution, or recompute -b:v from Section 5.

height not divisible by 2 error

Cause: An odd output dimension; H.264 requires even width and height. Fix: Use -2 for the auto-computed side, e.g. scale=-2:720.

Two-pass leaves ffmpeg2pass-0.log files behind

Cause: Pass 1 writes a stats log used by pass 2. Fix: They are safe to delete after pass 2 finishes.

Audio sounds bad after compression

Cause: 96 kbps is fine for speech but thin for music. Fix: Raise audio to -b:a 128k and accept slightly less video budget.

Recipient says the video won’t play

Cause: A non-standard pixel format from the source. Fix: Add -pix_fmt yuv420p to the encode command for maximum compatibility.


FAQ

Q1. Why aim under the limit instead of right at it? A. Mail systems encode attachments (Base64), which adds overhead in transit, and some servers count headers toward the cap. Targeting ~80% of the limit avoids surprise bounces.

Q2. CRF or two-pass — which should I use? A. Use CRF (Section 2) when you just want “smaller, good enough.” Use two-pass (Section 4) when you must land just under a hard cap.

Q3. The clip is several minutes long. Can I still email it? A. Maybe, but quality will suffer. For long clips, a shared link (cloud storage) is usually better than an attachment.

Q4. Does this re-encode the video? A. Yes — all three methods re-encode (lossy). Plain remuxing can’t shrink a file. See Compress Video.

Q5. Can I just trim instead of compressing? A. If only part of the clip matters, trimming first is the most effective size cut of all — then compress the shorter clip.



Tested with FFmpeg 8.1 — verified with our command-check script Primary sources: ffmpeg.org/ffmpeg.html / trac.ffmpeg.org/wiki/Encode/H.264 / trac.ffmpeg.org/wiki/Scaling