When you upload video to YouTube, the wrong encoding settings cause extra quality loss during YouTube’s re-encode. This article walks through FFmpeg commands that follow YouTube’s recommended spec.
Tested with: FFmpeg 6.1 (ubuntu-latest / GitHub Actions CI-verified)
YouTube Recommended Spec
| Item | YouTube recommendation |
|---|---|
| Video codec | H.264 (MP4 recommended) |
| Frame rate | 24, 25, 30, 48, 50, 60 fps |
| Resolution | 1080p or higher (up to 8K) |
| Audio codec | AAC-LC |
| Audio sample rate | 48 kHz |
| Audio channels | Stereo (2ch) recommended |
| Loudness | -14 LUFS integrated |
| Container | MP4 (recommended) |
Baseline Command (1080p H.264)
The maximum-compatibility settings for YouTube.
ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 18 \
-profile:v high \
-level 4.1 \
-pix_fmt yuv420p \
-movflags +faststart \
-c:a aac \
-b:a 192k \
-ar 48000 \
-ac 2 \
output_youtube.mp4
What each setting does:
| Option | Value | Why |
|---|---|---|
-crf 18 | 18 (high quality) | YouTube re-encodes, so start from a high-quality source |
-preset slow | slow | Compresses efficiently when paired with CRF |
-profile:v high | High | Profile recommended by YouTube |
-level 4.1 | 4.1 | Sufficient for 1080p/30fps and below |
-pix_fmt yuv420p | yuv420p | Maximum compatibility (browsers, phones) |
-movflags +faststart | — | Start playback immediately on the Web |
-b:a 192k | 192 kbps | YouTube’s audio bitrate ceiling |
-ar 48000 | 48 kHz | YouTube’s recommended sample rate |
Recommended Bitrates by Resolution
Since YouTube re-encodes uploads, you want enough headroom in the source so the result stays high-quality after their re-encode.
SDR (Standard Dynamic Range)
| Resolution | Frame rate | Recommended video bitrate | FFmpeg command |
|---|---|---|---|
| 4K (2160p) | 24–30 fps | 35–45 Mbps | -b:v 40M |
| 4K (2160p) | 48–60 fps | 53–68 Mbps | -b:v 60M |
| 1080p | 24–30 fps | 8 Mbps | -crf 18 |
| 1080p | 48–60 fps | 12 Mbps | -crf 17 |
| 720p | 24–30 fps | 5 Mbps | -crf 20 |
| 480p | 24–30 fps | 2.5 Mbps | -crf 23 |
Full-Auto via CRF (Recommended)
CRF mode adapts to scene complexity better than a hand-picked bitrate.
# For 1080p / 30fps
ffmpeg -i input.mp4 \
-c:v libx264 -crf 18 -preset slow \
-vf "scale=1920:1080:flags=lanczos,fps=30" \
-c:a aac -b:a 192k -ar 48000 -ac 2 \
-movflags +faststart \
output_1080p.mp4
# For 1080p / 60fps
ffmpeg -i input.mp4 \
-c:v libx264 -crf 17 -preset slow \
-vf "scale=1920:1080:flags=lanczos,fps=60" \
-c:a aac -b:a 192k -ar 48000 -ac 2 \
-movflags +faststart \
output_1080p60.mp4
Normalize Loudness to YouTube Standard
YouTube auto-normalizes loudness, but pre-normalizing lets you upload at exactly the loudness you intend.
# Normalize to -14 LUFS (YouTube standard)
ffmpeg -i input.mp4 \
-af "loudnorm=I=-14:TP=-1.5:LRA=11" \
-c:v copy \
output_normalized.mp4
See the volume adjustment tool (browser-based) for the same processing in the browser.
Shortcut: Upload an Existing Video with Minimal Processing
If the video is already H.264, you can swap only the container without re-encoding.
# MOV to MP4 (no codec change, fast)
ffmpeg -i input.mov -c copy -movflags +faststart output.mp4
# MKV to MP4 (no codec change)
ffmpeg -i input.mkv -c copy output.mp4
Uploading in H.265 (HEVC)
H.265 yields files about 50% smaller than H.264, but since YouTube’s final re-encode targets VP9 or AV1, the quality difference at the source is negligible.
ffmpeg -i input.mp4 \
-c:v libx265 -crf 20 -preset slow \
-tag:v hvc1 \
-c:a aac -b:a 192k -ar 48000 \
-movflags +faststart \
output_h265.mp4
-tag:v hvc1 is needed for QuickTime playback on iOS/macOS.
Common Issues and Fixes
Q. Quality drops after upload
If your source bitrate is too low, YouTube’s re-encode degrades it further. Use -crf 18 (H.264) or -crf 20 (H.265) or lower for high-quality encoding.
Q. Audio is missing or out of sync
# Check audio streams
ffprobe -v quiet -print_format json -show_streams input.mp4 | grep codec_type
If the audio codec isn’t supported by YouTube (e.g., PCM), convert to AAC.
Q. Settings for vertical video (YouTube Shorts)
# 9:16 vertical (1080x1920)
ffmpeg -i input.mp4 \
-vf "scale=1080:1920:flags=lanczos" \
-c:v libx264 -crf 18 -preset slow \
-c:a aac -b:a 192k -ar 48000 \
-movflags +faststart \
output_shorts.mp4
Try It in Your Browser Right Now
See the video compression tool — compress for YouTube while keeping file size down.
See the volume adjustment tool — normalize to -14 LUFS.
See the video format comparison — how to choose between MP4, WebM, MOV, and MKV.
Frequently Asked Questions
What is YouTube’s recommended bitrate for 1080p?
8 Mbps for 1080p 30 fps and 12 Mbps for 1080p 60 fps as a minimum. YouTube re-encodes everything, so over-shooting gives YouTube more headroom for quality.
Should I upload at 1080p or 4K?
Upload at the highest resolution you have. YouTube’s 4K transcode produces a higher-bitrate 1080p variant than a 1080p upload, even for 1080p viewers.
Two-pass or CRF for YouTube uploads?
CRF 17–18 with -preset slow gives near-master quality and is simpler than two-pass. Two-pass only matters when targeting an exact upload size.
Why does my upload look soft after YouTube processing?
YouTube’s VP9/AV1 transcode is bitrate-capped per resolution. The fix is to upload higher resolution (4K → 1080p path) or wait for AV1 transcode (sharper than VP9).
Should I use HDR for YouTube?
Only if you mastered in HDR end-to-end and have a properly tagged HDR file (BT.2020, PQ or HLG). YouTube’s HDR-to-SDR fallback for non-HDR viewers can look worse than pure SDR.