Video Hardware Acceleration on Mac

I observe significant performance differences when encoding a video in mp4 format (H264). The code I use is standard (using AVAssetWriter, AVAssetWriterInput...).

Here is what I notice when I run the same code on different platforms:

  • On an iPhone, the video is encoded in 3 seconds (iPhone 13, 14, 15, 16, Pro...).
  • On a Mac equipped with an M2 Pro, the video is encoded in 50 seconds.
  • On a Mac equipped with an Intel processor (2,3 GHz Intel Xeon W 18 cœurs), the video is encoded in 2 minutes.

The encoding on an iPhone is very fast due to hardware acceleration. However, I don’t understand why I don’t get similar performance with a Mac M2 Pro, which is equipped with a dedicated component for hardware acceleration (H264 media engine)?

Is hardware acceleration disabled on a Mac?

Video Hardware Acceleration on Mac
 
 
Q