What You Will Learn
- What VideoToolbox is and which Macs can use it
- Basic usage of
h264_videotoolboxandhevc_videotoolbox - How to set bitrate and quality options
- Apple Silicon-specific considerations
- Common errors and how to fix them
Tested with: FFmpeg 6.1 (macOS / Apple Silicon environment)
Target OS: macOS 10.8 and later (Intel and Apple Silicon alike)
What Is VideoToolbox
VideoToolbox is the hardware video encoding and decoding framework built into macOS. It uses your Mac’s GPU (Intel iGPU, or the integrated GPU on Apple Silicon) to encode video at high speed.
| Mac | Supported Codecs |
|---|---|
| Intel Mac (2011 and later) | H.264 |
| Intel Mac (2017 and later) | H.264, H.265 |
| Apple Silicon (M1/M2/M3) | H.264, H.265, ProRes (partial) |
Prerequisites
Because VideoToolbox is included with macOS by default, no special drivers are required. However, FFmpeg must be built with VideoToolbox support.
The Homebrew build of FFmpeg enables VideoToolbox by default:
※ This command requires an Apple Silicon / macOS environment
brew install ffmpeg
Check for supported encoders:
※ This command requires an Apple Silicon / macOS environment
ffmpeg -encoders | grep videotoolbox
Basic h264_videotoolbox Command
※ This command requires an Apple Silicon / macOS environment
ffmpeg -i input.mp4 -c:v h264_videotoolbox -b:v 4M -c:a aac -b:a 128k output_vt.mp4
Important: VideoToolbox does not support CRF mode (-cq); bitrate specification (-b:v) is the primary approach.
hevc_videotoolbox (H.265)
※ This command requires an Apple Silicon / macOS environment
ffmpeg -i input.mp4 -c:v hevc_videotoolbox -b:v 2M -c:a aac -b:a 128k output_hevc_vt.mp4
H.265 delivers quality equivalent to H.264 while reducing file size by roughly 40–50%.
Bitrate Control Options
| Option | Description |
|---|---|
-b:v 4M | Target bitrate (4 Mbit/s) |
-maxrate 6M | Maximum bitrate (the VBR ceiling) |
-bufsize 8M | Buffer size (used together with -maxrate) |
Example VBR setup that prioritizes quality:
※ This command requires an Apple Silicon / macOS environment
ffmpeg -i input.mp4 -c:v h264_videotoolbox -b:v 5M -maxrate 8M -bufsize 10M -c:a aac output.mp4
Profile Specification
You can specify the H.264 profile:
※ This command requires an Apple Silicon / macOS environment
ffmpeg -i input.mp4 -c:v h264_videotoolbox -profile:v high -b:v 4M output.mp4
Available profiles: baseline, main, high
Apple Silicon (M1/M2/M3)-Specific Considerations
Apple Silicon Macs ship with a more efficient media engine, and FFmpeg’s VideoToolbox uses it automatically. No special options are needed.
On macOS 13 (Ventura) and later, hevc_videotoolbox can in some cases handle HDR content (Dolby Vision, HDR10) as well:
※ This command requires an Apple Silicon / macOS environment
ffmpeg -i input_hdr.mp4 -c:v hevc_videotoolbox -b:v 8M -tag:v hvc1 output_hdr.mp4
-tag:v hvc1 is recommended for playback compatibility on Apple devices (iPhone, iPad, Apple TV).
Common Errors and How to Fix Them
Encoder h264_videotoolbox not found
- FFmpeg was not built with VideoToolbox support
- Use the Homebrew build (
brew install ffmpeg) - Verify with
ffmpeg -encoders | grep videotoolbox
Error: -2 (codec not currently supported in this container format)
- You are trying to output H.265 to an unsupported container such as
.avi - Change the output to
.mp4or.mov
Low Quality / Blocking Artifacts
- Because VideoToolbox does not support CRF mode, set
-b:vhigher (5M–8M) - If you need high quality, consider
libx264/libx265software encoding
Choosing Between Software and Hardware Encoding
| Use Case | Recommendation |
|---|---|
| High-quality archiving | libx264 / libx265 (software) |
| Fast transcoding / batch processing | VideoToolbox |
| Final Cut Pro integration | VideoToolbox (hvc1 tag) |
| CRF quality control needed | Software encoding |
Speed and Quality Ballparks (Typical Ranges)
These are typical ranges observed in public benchmarks and vary with the chip (M1–M3, Intel) and resolution.
- Encode speed: An M1/M2-class Apple Silicon Mac often encodes 1080p H.264 at roughly 5–10× realtime, clearly faster than
libx264 -preset medium(around 1.5–3× realtime). M1/M2 ship one to two media engines, and the higher Pro/Max tiers scale throughput up further. - Quality trade-off: At a matched quality target, VideoToolbox generally needs a higher bitrate than
libx264to reach the same VMAF; the exact gap depends on the chip generation and content. Because CRF is unsupported and bitrate is the most predictable control, starving the bitrate makes blocking artifacts likely. Numbers depend on chip, content, and resolution. - HEVC benefit:
hevc_videotoolboxtypically delivers comparable quality at a meaningfully smaller size than H.264 — useful for both streaming and storage.
Common Pitfalls
-crf/-cq has no effect
- Symptom: Adding
-crf 23errors out or is ignored. - Cause: VideoToolbox does not support CRF. Bitrate is the most predictable control. A
-q:voption exists but behaves differently from libx264’s-qscaleand is version/device-dependent. - Fix: Set a target with
-b:v(e.g.5M) and cap VBR with-maxrate/-bufsize. If quality is short, raise the bitrate or switch tolibx264 -crffor quality-driven control.
-q:v behaves differently than in libx264
- Symptom: You pass
-q:vbut don’t get the expected quality. - Cause: VideoToolbox’s
-q:v(quality) behavior varies by implementation and version and is not the same as libx264’s-qscale; it doesn’t always apply reliably. - Fix: Drive quality with
-b:vby default and don’t depend on-q:v. Use software encoding when you need a dependable quality target.
Apple Silicon and Intel Macs don’t match on quality/speed
- Symptom: The same command yields different results on an Intel Mac versus Apple Silicon.
- Cause: Media-engine generation differences. Apple Silicon’s dedicated engine is efficient and has different quality characteristics from an Intel iGPU.
- Fix: Tune the bitrate per machine. Older Intel Macs may lack H.265 support, so confirm with
ffmpeg -encoders | grep videotoolbox.
Plays in .mp4 but shows no video on Apple devices
- Symptom: HEVC output plays in VLC on the Mac but won’t display on iPhone/Apple TV.
- Cause: The HEVC codec tag is
hev1; Apple devices and apps are more compatible with thehvc1tag. - Fix: Use
-tag:v hvc1when targeting Apple playback, and use a.mp4or.movcontainer.
FAQ
Can I do CRF quality control with VideoToolbox?
CRF is unsupported. Bitrate is the most predictable control: set a target with -b:v and cap it with -maxrate/-bufsize. A -q:v option exists but behaves differently from libx264 and is version/device-dependent, so don’t rely on it. If you need CRF-style “variable size, constant quality,” use libx264 -crf.
Can I use the same command on M1 and Intel Macs?
The basic commands are shared. However, Apple Silicon has a more efficient media engine, so at the same bitrate the quality and speed characteristics differ. Older Intel Macs may not support H.265, so check the available encoders first.
Can VideoToolbox output ProRes?
Some Apple Silicon generations expose prores_videotoolbox. It’s useful as an intermediate codec for Final Cut Pro, but availability depends on the chip generation, so verify with ffmpeg -encoders | grep prores.
How do I encode with low latency for streaming?
You can reduce latency with -realtime true (on builds that support it) and by tightening -bufsize. For strict low latency, a CBR-leaning setup that stabilizes the bitrate works best.
What bitrate should I set?
For 1080p, around 4–6 Mbps for H.264 and 2–4 Mbps for HEVC are common starting points. For high-motion footage or visible blocking, raise it by 10–20%. Since there’s no CRF, leaving bitrate headroom is the safe choice.
Related Articles
- NVENC (NVIDIA GPU) Hardware Encoding
- VAAPI (Linux) Hardware Encoding
- Compressing Video — CRF and Target Bitrate
Primary sources: trac.ffmpeg.org/wiki/HWAccelIntro / developer.apple.com/documentation/videotoolbox