Hardware-accelerated encoding with VideoToolbox
compression
// what it does
Encodes H.264 on Apple Silicon/Intel Macs using the VideoToolbox media engine instead of the CPU, which is far faster and lower-power than a libx264 CPU encode. -b:v 5M sets the target bitrate, since VideoToolbox is bitrate-driven rather than CRF-driven by default. Use this on macOS when you need speed for large or many files and can accept lower compression efficiency than a CPU x264 encode.
// shell
$ ffmpeg -i input.mp4 -c:v h264_videotoolbox -b:v 5M output.mp4// gotcha
h264_videotoolbox has no true CRF mode, so quality tracks the bitrate you set — too low a -b:v gives visibly worse results than libx264 at the same number. It also ignores libx264-style -preset flags; those apply only to the software encoder.