YouTube re-encodes every video you upload. If your file was encoded with the wrong settings, it loses extra quality in that step.
YouTube Recommended Spec
| Item | YouTube recommendation |
|---|---|
| Video codec | H.264 (MP4 recommended) |
| Frame rate | 24, 25, 30, 48, 50, 60 fps |
| Resolution | Up to 8K |
| Audio codec | AAC-LC |
| Audio sample rate | 48 kHz |
| Audio channels | Stereo (2ch) recommended |
| Loudness | Not specified (-14 LUFS integrated is a common target) |
| Container | MP4 (recommended) |
Baseline Command (1080p H.264)
The most compatible 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 384k \
-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 high quality |
-preset slow |
slow | Compresses efficiently with CRF |
-profile:v high |
High | The profile YouTube recommends |
-level 4.1 |
4.1 | Enough for 1080p at 30fps and below |
-pix_fmt yuv420p |
yuv420p | Most compatible (browsers, phones) |
-movflags +faststart |
— | Playback on the web starts right away |
-b:a 384k |
384 kbps | YouTube’s recommended audio bitrate for stereo |
-ar 48000 |
48 kHz | YouTube’s recommended sample rate |
Recommended Bitrates by Resolution
YouTube re-encodes what you upload, so give the source enough bitrate that it still looks good afterwards.
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 | -b:v 8M |
| 1080p | 48–60 fps | 12 Mbps | -b:v 12M |
| 720p | 24–30 fps | 5 Mbps | -b:v 5M |
| 480p | 24–30 fps | 2.5 Mbps | -b:v 2500k |
Full-Auto via CRF (Recommended)
CRF adjusts the bitrate to each scene, which works better than a bitrate you pick by hand.
# 1080p, source at 24–30 fps
ffmpeg -i input.mp4 \
-c:v libx264 -crf 18 -preset slow \
-vf "scale=-2:1080:flags=lanczos" \
-c:a aac -b:a 384k -ar 48000 -ac 2 \
-movflags +faststart \
output_1080p.mp4
# 1080p, source at 48–60 fps
ffmpeg -i input.mp4 \
-c:v libx264 -crf 17 -preset slow \
-vf "scale=-2:1080:flags=lanczos" \
-c:a aac -b:a 384k -ar 48000 -ac 2 \
-movflags +faststart \
output_1080p60.mp4
Both commands keep the frame rate of the source, because YouTube asks for video in the frame rate it was recorded at (YouTube Help). scale=-2:1080 makes the height 1080 and keeps the aspect ratio.
Normalize Loudness to YouTube Standard
YouTube adjusts loudness on its own. If you normalize before uploading, the video has exactly the loudness you chose.
# Normalize to -14 LUFS (a common target)
ffmpeg -i input.mp4 \
-af "loudnorm=I=-14:TP=-1.5:LRA=11" \
-c:v copy \
-c:a aac -b:a 384k -ar 48000 \
output_normalized.mp4
loudnorm raises the sample rate to 192 kHz while it works, so -ar 48000 sets it back to 48 kHz.
The volume adjustment tool does the same in your browser.
Shortcut: Upload an Existing Video with Minimal Processing
If the video is already H.264, you can change only the container and skip 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)
At the same VMAF score, H.265 files came out 26–35% smaller than H.264 in a measured comparison, not the 50% often quoted. YouTube re-encodes every upload anyway, so uploading in H.265 makes almost no difference to quality.
ffmpeg -i input.mp4 \
-c:v libx265 -crf 20 -preset slow \
-tag:v hvc1 \
-c:a aac -b:a 384k -ar 48000 \
-movflags +faststart \
output_h265.mp4
-tag:v hvc1 is needed for the file to play in QuickTime on iOS and macOS.
Common Issues and Fixes
Q. Quality drops after upload
If the source bitrate is too low, YouTube’s re-encode makes it worse. Encode at -crf 18 (H.264) or -crf 20 (H.265), or lower.
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 no line shows "codec_type": "audio", the file has no audio track. When you convert the audio, use AAC-LC (-c:a aac), which YouTube recommends.
Q. Settings for vertical video (YouTube Shorts)
# Footage that is already vertical (9:16) to 1080x1920
ffmpeg -i input.mp4 \
-vf "scale=1080:1920:flags=lanczos" \
-c:v libx264 -crf 18 -preset slow \
-c:a aac -b:a 384k -ar 48000 \
-movflags +faststart \
output_shorts.mp4
This command does not turn a horizontal 16:9 video into a vertical one. The picture is squeezed, and players still show it as 16:9. Crop or pad a horizontal video to 9:16 first (vertical video).
Try It in Your Browser Right Now
- Video compression tool: compress a video for YouTube and keep the file small.
- Volume adjustment tool: normalize the audio to -14 LUFS.
- Video format comparison: how to choose between MP4, WebM, MOV and MKV.
Frequently Asked Questions
What is YouTube’s recommended bitrate for 1080p?
YouTube recommends 8 Mbps for 1080p at 30 fps and 12 Mbps for 1080p at 60 fps.
Should I upload at 1080p or 4K?
Upload at the highest resolution you have. Upscaling 1080p footage to 4K does not add 4K detail.
Two-pass or CRF for YouTube uploads?
CRF 17–18 with -preset slow gives quality close to the master and is simpler than two-pass. Two-pass only matters when the upload must be an exact size.
Why does my upload look soft after YouTube processing?
YouTube caps the bitrate of its VP9 and AV1 versions at each resolution. The 1080p and 4K versions also take longer to process, so for several hours after upload they may not be available yet (YouTube Help). Quality can also improve once YouTube’s AV1 version is ready.
Should I use HDR for YouTube?
Only if you worked in HDR from start to finish and the file is tagged correctly as HDR (BT.2020, PQ or HLG). For viewers without HDR, YouTube converts the video to SDR, and that version can look worse than a video made in SDR.