Hardware Accelerated Video Encoding on macOS with ffmpeg
ffmpeg can use a hardware acceleration framework called VideoToolbox for h264 or hevc on macOS 10.8 and later.
ffmpeg -i input.mp4 -c:v h264_videotoolbox -preset veryfast -b:v 5M -c:a aac -b:a 128k output.mp4
Keep in mind this encoder does not support the same flags as the default x264 decoder.
Hardware encoding runs at ~8.5x speed on my Mac Book Pro 13”, Dual-Core Intel Core i7. Software encoding runs at ~1.7x speed. so the difference is pretty dramatic.
Resulting file sizes are comparable in my example. People claim software encoding usually gives a better quality.