YouTube re-encodes every video you upload.

Item YouTube recommendation
Video codec H.264 (MP4 recommended)
Frame rate Same as recorded (24, 25, 30, 48, 50, 60 fps, etc.)
Resolution Up to 8K
Audio codec AAC-LC (Opus also accepted)
Audio sample rate 48 kHz
Audio channels Stereo (5.1 also accepted)
Loudness Not specified (-14 LUFS integrated is a common target)

Baseline Command (1080p H.264)

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
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

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

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 -pix_fmt yuv420p \
  -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 -pix_fmt yuv420p \
  -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 -14 LUFS

# Normalize to -14 LUFS (a common target for YouTube; one loudnorm pass can land about 1 LU off)
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.

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 25–35% smaller than H.264 on the test clip in a measured comparison, not the 40–50% often quoted. YouTube recommends H.264. YouTube re-encodes every upload, so uploading in H.265 does not necessarily improve quality on YouTube.

ffmpeg -i input.mp4 \
  -c:v libx265 -crf 20 -preset slow -pix_fmt yuv420p \
  -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

# 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 -pix_fmt yuv420p \
  -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

Frequently Asked Questions

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 high quality 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?

Right after upload, only low quality may be available. Processing 1080p and 4K can take several hours (YouTube Help).

Should I use HDR for YouTube?

Only if the footage was shot and finished in HDR, in 10-bit, with BT.2020 and PQ or HLG tagged correctly. On screens without HDR, YouTube converts the video to SDR automatically, which may not look ideal on difficult clips (YouTube Help).