

Master video compression for YouTube with our complete guide. Learn optimal settings, codecs, bitrates, and tools to get perfect quality uploads every time.
How to Compress Videos for YouTube: Ultimate Guide
YouTube automatically re-encodes all uploaded videos, but uploading poorly compressed videos results in longer upload times, quality loss, and encoding delays. This guide shows you how to compress videos optimally before uploading to YouTube.
Quick Reference: YouTube's Recommended Settings
| Resolution | Bitrate (SDR) | Bitrate (HDR) | FPS | Codec |
|---|---|---|---|---|
| 4K (2160p) | 35-45 Mbps | 53-68 Mbps | 24-60 | H.264/H.265 |
| 1440p | 16 Mbps | 24 Mbps | 24-60 | H.264 |
| 1080p | 8 Mbps | 12 Mbps | 24-60 | H.264 |
| 720p | 5 Mbps | 7.5 Mbps | 24-60 | H.264 |
| 480p | 2.5 Mbps | - | 24-30 | H.264 |
Understanding YouTube's Processing
When you upload a video, YouTube:
- Accepts your upload - Original file stored temporarily
- Transcodes to multiple formats - Creates versions for different devices
- Generates multiple qualities - 144p through 4K/8K
- Applies compression - Further reduces file size
- Distributes globally - Copies to CDN servers
Key insight: YouTube will re-compress your video regardless, but starting with optimal settings minimizes quality loss.
Best Codecs for YouTube Upload
1. H.264 (AVC) - Best Compatibility
When to use: Almost always (YouTube's preferred codec)
# FFmpeg command for H.264
ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 18 \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
output.mp4
Advantages:
- Universal compatibility
- Fast YouTube processing
- Excellent quality/size ratio
- Supported by all devices
Settings:
- CRF 18-23 for high quality (lower = better)
- Preset: slow for better compression
- Profile: high for best features
2. H.265 (HEVC) - Better Compression
When to use: 4K/8K content, when file size matters
# FFmpeg command for H.265
ffmpeg -i input.mp4 \
-c:v libx265 \
-preset medium \
-crf 22 \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
-tag:v hvc1 \
output.mp4
Advantages:
- 30-50% smaller files than H.264
- Better for 4K/8K content
- HDR support
Disadvantages:
- Slower to encode
- Some older devices struggle
- YouTube processing takes longer
3. VP9 - Open Alternative
When to use: Rarely (YouTube converts to VP9 automatically)
VP9 is YouTube's preferred streaming codec, but you should upload H.264 and let YouTube handle VP9 conversion.
Resolution & Frame Rate
Choosing Resolution
Best practices:
- Record at native resolution (don't upscale)
- Match your source material
- Consider your audience's devices
| Content Type | Recommended Resolution |
|---|---|
| Professional content | 4K (3840x2160) |
| Standard YouTube videos | 1080p (1920x1080) |
| Gaming/streaming | 1080p 60fps |
| Tutorials/talking head | 1080p 30fps |
| Mobile-first content | 720p |
Frame Rate Settings
Common frame rates:
- 24 fps - Cinematic look
- 30 fps - Standard YouTube content
- 60 fps - Gaming, sports, smooth motion
Important: Don't convert frame rates (30→60). Upload at source frame rate.
# Check video frame rate
ffmpeg -i video.mp4 2>&1 | grep "fps"
# Maintain original frame rate
ffmpeg -i input.mp4 -r 30 -c:v libx264 output.mp4
Bitrate Guidelines
Variable Bitrate (VBR) vs Constant Bitrate (CBR)
For YouTube uploads, use VBR:
- More efficient compression
- Better quality at same file size
- YouTube's recommendation
Bitrate Calculator
Formula: Bitrate (Mbps) = (Resolution × FPS × Motion Factor) / Efficiency
Motion factors:
- Low motion (talking head): 0.07
- Medium motion (vlog): 0.1
- High motion (sports, gaming): 0.15
Example for 1080p 30fps medium motion:
- (1920×1080) × 30 × 0.1 / 1000 = ~6 Mbps
Audio Bitrate
| Quality | Bitrate | Use Case |
|---|---|---|
| Minimum | 96 kbps | Podcasts, voice only |
| Standard | 128 kbps | General content |
| Recommended | 192 kbps | Most YouTube videos |
| High quality | 256-320 kbps | Music, ASMR |
Compression Methods
Method 1: Using FFmpeg (Best Quality)
Basic compression:
# High quality (recommended for YouTube)
ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 18 \
-maxrate 8M \
-bufsize 12M \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
-movflags +faststart \
output.mp4
What each parameter does:
-c:v libx264- Use H.264 codec-preset slow- Better compression (slower encoding)-crf 18- Quality level (18-23 for YouTube)-maxrate 8M- Maximum bitrate for 1080p-bufsize 12M- Playback buffer size-pix_fmt yuv420p- Color format (required for compatibility)-c:a aac- AAC audio codec-b:a 192k- Audio bitrate-movflags +faststart- Enable streaming before download complete
For 4K content:
ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 18 \
-maxrate 40M \
-bufsize 60M \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
-movflags +faststart \
output_4k.mp4
Method 2: HandBrake (User-Friendly)
Settings for YouTube:
- Format: MP4
- Video Codec: H.264 (x264)
- Framerate: Same as source
- Quality: Constant Quality, RF 20-22
- Audio: AAC, 192 kbps
- Preset: Slow or Very Slow
Why HandBrake:
- Visual interface
- Presets for common devices
- Batch processing
- Queue management
Method 3: Adobe Media Encoder
Recommended settings:
Format: H.264
Preset: YouTube 1080p Full HD
Encoding Settings:
- Performance: Hardware Encoding (if available)
- Profile: High
- Level: 4.2
- Bitrate Settings: VBR, 1 pass
- Target Bitrate: 8 Mbps (1080p)
- Maximum Bitrate: 12 Mbps
Audio:
- Codec: AAC
- Bitrate: 192 kbps
- Sample Rate: 48000 Hz
Special Cases
1. Large Files (>50GB)
YouTube's upload limit is 256GB or 12 hours, but large files are problematic:
Solution: Two-pass encoding
# First pass
ffmpeg -i input.mp4 -c:v libx264 -preset slow -b:v 8M \
-pass 1 -f null /dev/null
# Second pass
ffmpeg -i input.mp4 -c:v libx264 -preset slow -b:v 8M \
-pass 2 -c:a aac -b:a 192k output.mp4
Benefits:
- More consistent quality
- Better bitrate distribution
- Smaller file size
2. Screen Recordings
Screen recordings (tutorials, gameplay) need special treatment:
ffmpeg -i screencast.mp4 \
-c:v libx264 \
-preset medium \
-crf 23 \
-pix_fmt yuv420p \
-vf "scale=1920:1080" \
-c:a aac \
-b:a 128k \
output.mp4
Tips:
- Use CRF 23 (text needs clarity)
- Don't use high motion settings
- 30fps is usually sufficient
3. Phone/Camera Footage
Raw phone footage is often inefficient:
# Compress phone video
ffmpeg -i phone_video.mov \
-c:v libx264 \
-preset slow \
-crf 20 \
-vf "scale=1920:1080:force_original_aspect_ratio=decrease" \
-c:a aac \
-b:a 192k \
-movflags +faststart \
optimized.mp4
Real example:
- iPhone 13 Pro: 4K 60fps = 500 MB/min
- After optimization: 4K 60fps = 150 MB/min
- 70% file size reduction with minimal quality loss
4. Green Screen / Chroma Key
Videos with green screen need careful compression:
ffmpeg -i greenscreen.mp4 \
-c:v libx264 \
-preset slow \
-crf 18 \
-pix_fmt yuv420p \
-profile:v high \
-c:a aac \
-b:a 192k \
output.mp4
Why lower CRF:
- Color accuracy matters
- Compression artifacts affect keying
- Use CRF 18 instead of 22
Quality vs File Size Examples
Testing with 10-minute 1080p 30fps video:
| Method | File Size | Quality | Upload Time (100 Mbps) |
|---|---|---|---|
| Uncompressed | 15 GB | Perfect | 20 min |
| CRF 18 (recommended) | 1.2 GB | Excellent | 1.6 min |
| CRF 23 | 600 MB | Very Good | 48 sec |
| CRF 28 | 300 MB | Good | 24 sec |
| Over-compressed | 100 MB | Poor | 8 sec |
Recommendation: CRF 18-20 offers the best quality/size balance for YouTube.
Batch Processing
Process Multiple Videos
#!/bin/bash
# Batch compress for YouTube
for video in *.mp4; do
echo "Processing: $video"
ffmpeg -i "$video" \
-c:v libx264 \
-preset slow \
-crf 20 \
-maxrate 8M \
-bufsize 12M \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
-movflags +faststart \
"youtube_${video}"
done
echo "All videos processed!"
Python Script for Automation
import subprocess
import os
def compress_for_youtube(input_file, output_file):
command = [
'ffmpeg',
'-i', input_file,
'-c:v', 'libx264',
'-preset', 'slow',
'-crf', '20',
'-maxrate', '8M',
'-bufsize', '12M',
'-pix_fmt', 'yuv420p',
'-c:a', 'aac',
'-b:a', '192k',
'-movflags', '+faststart',
output_file
]
subprocess.run(command, check=True)
# Process all MP4 files
for filename in os.listdir('.'):
if filename.endswith('.mp4'):
output = f'youtube_{filename}'
print(f'Compressing {filename}...')
compress_for_youtube(filename, output)
Common Mistakes to Avoid
Upscaling low-resolution content
- Don't convert 720p → 4K (YouTube won't improve quality)
- Upload at source resolution
Using CBR instead of VBR
- VBR provides better quality at same file size
- YouTube recommends VBR
Over-compressing
- CRF > 28 introduces visible artifacts
- YouTube will compress further, multiplying quality loss
Wrong pixel format
- Always use
yuv420pfor compatibility - Other formats may not work on all devices
- Always use
Ignoring audio quality
- Low audio bitrate (<128 kbps) is very noticeable
- Use at least 192 kbps AAC
Not using
-movflags +faststart- Without this, video can't stream before fully downloaded
- YouTube processing may be slower
Upload Optimization Checklist
Before uploading to YouTube:
☑ Format: MP4 or MOV
☑ Codec: H.264 (libx264) or H.265 (libx265)
☑ Resolution: Native (don't upscale)
☑ Frame rate: Same as source (24, 30, or 60 fps)
☑ Bitrate: Following YouTube's recommendations
☑ Audio: AAC, 192 kbps, 48 kHz
☑ Pixel format: yuv420p
☑ Faststart enabled: For streaming
☑ File size: Reasonable for upload time
☑ Test playback: Watch full video before uploading
Advanced: Hardware Acceleration
Use GPU encoding for faster processing:
NVIDIA GPU (NVENC)
ffmpeg -i input.mp4 \
-c:v h264_nvenc \
-preset p7 \
-cq 20 \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
output.mp4
AMD GPU
ffmpeg -i input.mp4 \
-c:v h264_amf \
-quality quality \
-qp 20 \
-c:a aac \
-b:a 192k \
output.mp4
Apple Silicon (VideoToolbox)
ffmpeg -i input.mp4 \
-c:v h264_videotoolbox \
-b:v 8M \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
output.mp4
Trade-off: Hardware encoding is 3-10× faster but produces slightly larger files or lower quality compared to software encoding at the same bitrate.
Troubleshooting
"Video is still processing" stuck on YouTube
Causes:
- Non-standard codec or format
- Very large file size
- Unusual resolution or frame rate
Solution:
Re-encode with strict YouTube specs:
ffmpeg -i input.mp4 \
-c:v libx264 \
-profile:v high \
-level 4.2 \
-pix_fmt yuv420p \
-c:a aac \
-ar 48000 \
output.mp4
Quality loss after YouTube processing
This is normal, but minimize it:
- Upload highest quality source possible
- Use CRF 18 (not 23+)
- Upload in 4K even if source is 1080p (gives YouTube more data)
- Use H.264 High profile
Long upload times
Solutions:
- Compress more aggressively (CRF 23 instead of 18)
- Use hardware encoding for speed
- Use 2-pass encoding for better compression
- Upload during off-peak hours
Conclusion: Best Practice Workflow
For most YouTube videos (1080p 30fps):
ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 20 \
-maxrate 8M \
-bufsize 12M \
-pix_fmt yuv420p \
-c:a aac \
-b:a 192k \
-movflags +faststart \
youtube_upload.mp4
This gives you:
- Excellent quality (CRF 20)
- Reasonable file size (60-100 MB per minute)
- Fast YouTube processing
- Compatible with all devices
- Streamable before full download
Quick wins:
- 15 GB raw footage → 1.2 GB optimized (92% smaller)
- Upload time: 20 min → 1.6 min (12× faster)
- YouTube processing: Fast (minutes, not hours)
Final tip: Always test your settings on a 30-second clip first, then apply to full video!
Need to compress videos for YouTube? Use our free video converter with YouTube-optimized presets. Batch process your videos in minutes!
About the Author

1CONVERTER Media Team
Official TeamAudio & Video Specialists
Our media engineering team handles video and audio conversions using industry-standard encoding technologies. We optimize for quality retention while providing flexible compression options for various use cases.
📬 Get More Tips & Guides
Join 10,000+ readers who get our weekly newsletter with file conversion tips, tricks, and exclusive tutorials.
🔒 We respect your privacy. Unsubscribe at any time. No spam, ever.