TTrimpx

Step-by-Step Guide

How to Compress Video for YouTube Upload in 2026

Reduce your video file size by 30-70% without visible quality loss. Complete FFmpeg guide with copy-ready commands, CRF recommendations and codec comparisons optimized specifically for YouTube's re-encoding pipeline.

Why Compress for YouTube?

YouTube accepts uploads up to 256GB, but larger files mean longer upload times and potential processing delays. More importantly, if you use settings that are too aggressive, the double-compression (your encode + YouTube's encode) can produce visible quality artifacts. The goal is finding the sweet spot where your compressed file looks identical to the original on YouTube.

Step 1: Choose the Right Codec

CodecCompressionYouTube SupportRecommended
H.264 (libx264)Baseline✅ UniversalYes (default)
H.265 (libx265)+25-35%✅ GoodFor small files
VP9 (libvpx-vp9)+40-50%✅ GoodWEBM/Web use
AV1 (libaom-av1)+60-70%⚠ GrowingFor future-proofing

Recommendation: Use H.264 for YouTube uploads in 2026. AV1 offers better compression but limited hardware encoding support. See our codec comparison for details.

Step 2: Set the Optimal CRF Value

CRF 18★ Best for YouTube masters — virtually indistinguishable from source
CRF 20★ Excellent quality, ~2x smaller than CRF 18
CRF 23Default — great for general web use, ~3x smaller than CRF 18
CRF 28Smaller files, acceptable quality loss — social media

For YouTube specifically: use CRF 18-20. YouTube re-encodes your video at their end, so going lower than CRF 18 gives diminishing returns. Use our CRF calculator to estimate file sizes for different CRF values.

Step 3: Copy-Ready FFmpeg Commands

YouTube Master (Best Quality)

ffmpeg -i input.mp4 \ -c:v libx264 -crf 18 -preset medium \ -c:a aac -b:a 192k \ -movflags +faststart \ output-youtube-master.mp4

Balanced (Good Quality, Smaller File)

ffmpeg -i input.mp4 \ -c:v libx264 -crf 20 -preset slow \ -c:a aac -b:a 192k \ -movflags +faststart \ output-youtube-balanced.mp4

Maximum Compression (Smallest File)

ffmpeg -i input.mp4 \ -c:v libx265 -crf 22 -preset slow \ -c:a aac -b:a 128k \ -movflags +faststart \ output-youtube-compressed.mp4

Key flags explained:

  • -movflags +faststart — Moves metadata to the beginning for instant streaming playback
  • -c:a aac -b:a 192k — AAC audio at 192kbps (YouTube's preferred audio codec)
  • -preset slow — Takes longer but produces smaller files at same quality

Step 4: YouTube's Recommended Upload Specs

ResolutionMax Frame RateFile FormatCodec
1920 × 108060 fpsMP4H.264
1280 × 72060 fpsMP4H.264
3840 × 2160 (4K)60 fpsMP4H.264/VP9

YouTube automatically creates multiple resolutions from your upload, so you only need to encode once. The quality of your source determines all derivative qualities.

Frequently Asked Questions

Does compressing video before YouTube upload actually help?

Yes. While YouTube will re-encode your video, uploading a well-compressed file means YouTube starts from a good source. This results in faster processing, better final quality on their end, and avoids the "double compression" artifacts that occur when you upload unnecessarily large files.

Should I use CRF 18 or CRF 23 for YouTube?

Use CRF 18 if you want the best possible quality and don't mind larger files. Use CRF 20-23 for a good balance. The difference between CRF 18 and CRF 20 is barely noticeable on most screens, but file size can differ by 3-5x.

What's the smallest safe CRF value?

CRF 28 is the practical minimum for web content. Below that, quality loss becomes noticeable on most displays. For YouTube specifically, we recommend staying at CRF 18-23.