C.W.K.
Stream
Lesson 10 of 10 · published

YouTube Optimized Encoding

~12 min · youtube, upload, preset

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

YouTube re-encodes your upload anyway

Whatever you upload, YouTube transcodes to its own ladder (AV1, VP9, H.264 at multiple resolutions). Your goal isn't to ship the smallest file; it's to ship the highest-quality source so YouTube's transcoder has good input.

YouTube's recommended specs

YouTube publishes a recommended upload spec. As of 2026 it's roughly:

  • Video: H.264 high profile, progressive, no edit lists.
  • Bitrate: 1080p ≈ 8 Mbps SDR / 10 Mbps HDR. 4K ≈ 35–45 Mbps SDR.
  • Audio: AAC-LC 384 kbps stereo / 512 kbps 5.1.
  • Frame rate: source rate (don't convert).
  • Color space: BT.709 for SDR, BT.2020/PQ for HDR.

The recipe

Code

YouTube SDR 1080p upload (the safe default)·bash
ffmpeg -i master.mov \
  -c:v libx264 -crf 18 -preset slow \
  -pix_fmt yuv420p \
  -profile:v high -level 4.2 \
  -color_primaries bt709 -color_trc bt709 -colorspace bt709 \
  -c:a aac -b:a 384k -ar 48000 \
  -movflags +faststart \
  youtube_1080p.mp4
YouTube HDR10 4K upload·bash
ffmpeg -i master_hdr.mov \
  -c:v libx265 -crf 18 -preset slow -tag:v hvc1 \
  -pix_fmt yuv420p10le \
  -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc \
  -x265-params "hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc" \
  -c:a aac -b:a 384k -ar 48000 \
  -movflags +faststart \
  youtube_4k_hdr.mp4
Hardware-accelerated YouTube preset (fast, slightly lower quality)·bash
# Apple Silicon — same target, ~5x faster
ffmpeg -i master.mov \
  -c:v hevc_videotoolbox -b:v 12M -tag:v hvc1 \
  -pix_fmt yuv420p \
  -color_primaries bt709 -color_trc bt709 -colorspace bt709 \
  -c:a aac -b:a 384k -ar 48000 \
  -movflags +faststart \
  youtube_hw.mp4

External links

Exercise

Take a 60-second clip you'd actually upload. Encode it three ways: (a) the libx264 SDR recipe above, (b) the hevc_videotoolbox HW recipe, (c) a default -c:v libx264 -crf 23 with no other flags. Note the file sizes. Upload one to YouTube as Unlisted and look at the resulting bitrate ladder — does the platform produce equally sharp 1080p output regardless of which source you gave it? Write down what you find.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.