C.W.K.
Stream
Lesson 01 of 08 · published

YouTube Upload Optimization

~12 min · youtube, upload, preset

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

Recap: high-quality input, not small file

Track 3 lesson 10 covered the encode itself. This lesson is the broader workflow: faststart, color tagging, audio targets, the metadata that helps YouTube's transcoder make good decisions about your video.

The checklist

  1. -pix_fmt yuv420p (or yuv420p10le for HDR) — required.
  2. -movflags +faststart — moves MP4 metadata to the front. YouTube's ingestor accepts both, but having faststart on means the file plays correctly during background validation.
  3. Color tags consistent (BT.709 for SDR, BT.2020+PQ for HDR10).
  4. Audio at 384 kbps stereo / 512 kbps 5.1 — YouTube's recommended target for AAC.
  5. No edit lists, no B-frames-only-keyframes weirdness.
  6. CRF 18 -preset slow is the master-quality choice. Two-pass at high bitrate works too.

Code

YouTube SDR 1080p — full pipeline·bash
ffmpeg -i master.mov \
  -c:v libx264 -crf 18 -preset slow \
  -profile:v high -level 4.2 \
  -pix_fmt yuv420p \
  -color_primaries bt709 -color_trc bt709 -colorspace bt709 \
  -bf 2 -g 60 -refs 4 \
  -c:a aac -b:a 384k -ar 48000 -ac 2 \
  -movflags +faststart \
  -metadata title="Pippa Quest 1" \
  -metadata description="FFmpeg Quest — Track 7 sample" \
  youtube_1080p.mp4
YouTube 4K HDR10·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 -ac 2 \
  -movflags +faststart \
  youtube_4k_hdr.mp4
Bulk daily uploads — hardware preset·bash
# 5x faster than libx264 -preset slow, 'YouTube re-encodes anyway' quality
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 \
  daily_upload.mp4

External links

Exercise

Take a 60-second master clip. Encode it with the SDR 1080p recipe above. Confirm with ffprobe: pix_fmt is yuv420p, color tags are bt709, audio is 384 kbps AAC, faststart is present (look for moov atom early in the file via mp4dump -l 1 -a moov out.mp4). Upload as Unlisted to YouTube and inspect the resulting bitrates in Studio's stats.

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.