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

Apple Silicon Optimization

~12 min · apple-silicon, videotoolbox, macos

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

Why M-series Macs are special

Apple Silicon SoCs have dedicated media engines (the M3 Pro has 2 of them, the M3 Max has 4). They're staggeringly fast at H.264/HEVC/ProRes encode/decode. You won't get this speed from any consumer CPU. Even an M1 Pro outperforms a desktop Ryzen 9 + RTX 4080 on H.265 hardware encode for daily clips.

The optimal pattern

Decode in hardware (-hwaccel videotoolbox), keep frames on the GPU memory if you can avoid filters that force a CPU round-trip, encode in hardware. Result: a 4K 30-min source transcodes to H.265 in about 2 minutes.

Code

Pure-GPU transcode (Apple Silicon)·bash
# Frames stay in VideoToolbox memory the whole way
ffmpeg -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld \
  -i in.mp4 \
  -c:v hevc_videotoolbox -b:v 8M -tag:v hvc1 \
  -c:a copy \
  out.mp4
Hardware-accelerated scale (Apple)·bash
# scale_vt runs the resize on the media engine, not CPU
ffmpeg -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld \
  -i in.mp4 \
  -vf 'scale_vt=w=1280:h=-2' \
  -c:v hevc_videotoolbox -b:v 4M -tag:v hvc1 \
  -c:a copy \
  scaled_hw.mp4

# Most filters (drawtext, blur, color) don't have a _vt variant —
# they force a CPU download. For those, accept the round-trip or
# do the heavy filter step separately on a software pass.
ProRes hardware encode·bash
# prores_videotoolbox is much faster than prores_ks (CPU)
ffmpeg -i in.mp4 \
  -c:v prores_videotoolbox -profile:v 3 \
  -pix_fmt yuv422p10le \
  -c:a pcm_s16le \
  master.mov

# Note: Apple's ProRes hardware path produces files that Final Cut
# accepts identically to software ProRes.

External links

Exercise

On your M-series Mac, encode a 60-second 4K source three ways: libx264 -preset slow, libx265 -preset slow, hevc_videotoolbox -b:v 8M. Time each. Then run two hevc_videotoolbox encodes concurrently in two terminals. Did total throughput double, or did they fight for the engine?

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.