Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Pakorn

macrumors newbie
Original poster
May 7, 2025
9
0
I am using Handbrake to do some encoding of videos into h265. I have plenty of contradictory info on the internet : should I use CPU or Videotoolbox encoding ?
Thanks.
 
I am using Handbrake to do some encoding of videos into h265. I have plenty of contradictory info on the internet : should I use CPU or Videotoolbox encoding ?
Thanks.

It depends on your goals -- Videotoolbox (using Apple's hardware encoder) will encode by far the fastest. Software encoding on the CPU will generate smaller files for a given level of visual quality but will take multiple times longer.

At two extremes of use cases, people almost always use Videotoolbox when they want real-time encoding while people tend to use software/CPU encoding for archival purposes (or similarly creating files that will be saved for distribution to a lot of people).

Three additional notes:
-You didn't mention your hardware but Apple Silicon and the T2 chips share a similar media engine -- the ones in the Apple Silicon of course being a newer generation that are both faster and can handle newer media types (e.g. 10-bit HEVC for HDR)
-All else being equal you will probably want to use a relatively higher quality target setting when using hardware encoding (e.g. Videotoolbox) and will need to test different encoding parameters to find the quality/output size/encoding time tradeoff you want
-The relative tradeoffs vary between generations of hardware and so you need to check your assumptions/preferred parameters after major hardware upgrades
 
  • Like
Reactions: Basic75
It depends on your goals -- Videotoolbox (using Apple's hardware encoder) will encode by far the fastest. Software encoding on the CPU will generate smaller files for a given level of visual quality but will take multiple times longer.

At two extremes of use cases, people almost always use Videotoolbox when they want real-time encoding while people tend to use software/CPU encoding for archival purposes (or similarly creating files that will be saved for distribution to a lot of people).

Three additional notes:
-You didn't mention your hardware but Apple Silicon and the T2 chips share a similar media engine -- the ones in the Apple Silicon of course being a newer generation that are both faster and can handle newer media types (e.g. 10-bit HEVC for HDR)
-All else being equal you will probably want to use a relatively higher quality target setting when using hardware encoding (e.g. Videotoolbox) and will need to test different encoding parameters to find the quality/output size/encoding time tradeoff you want
-The relative tradeoffs vary between generations of hardware and so you need to check your assumptions/preferred parameters after major hardware upgrades
I have the Mini M4, therefore thinking whether I should encode HW or CPU...
 
I have the Mini M4, therefore thinking whether I should encode HW or CPU...

So great hardware for this and final choice depends on your goals and use case.

Probably best at this point is to compress/encode/etc a typical video file using software encoding with lowest quality setting you find desirable (for most people that would a setting with results that are visually indistinguishable from the originally). Record how long that takes and note the resulting file size. Then do the same using Videotoolbox (i.e. hardware encoding). How much faster was it and how much larger was the resulting file? If hardware encoded files come out 10x faster but are 1.5x larger is the size savings worth the extra time?

Also note that software encoding tends to make the rest of the system feel less responsive so that doing it during the day just may be impractical for you. Whereas if you planned to kick off the encoding to run overnight the extra speed from hardware encoding may not matter to you.
 
Why would anyone use software encoding when Apple made dedicated hardware specifically for encoding? What is better than dedicated hardware?
 
Software encoders can create a smaller file at the same quality of an hardware encoder, or a better quality file at the same size.

Hardware encoders are quick and dirty. It all depends on what you want to get.
 
  • Like
Reactions: bzgnyc2
CPU encoding gives a better quality at the same size.

This is H265, but H264 is nearly the same. I light up the Picture with gamma correction to better show the blocks.

Bildschirmfoto 2023-12-01 um 00.jpg
 
VideoToolbox does NOT use the GPU on Apple silicon. It uses the Media Engine, dedicated cores created specifically for decoding/encoding.
Apple-M4-Max-chip-CPU-performance_big.jpg.large.jpg
Apple-M4-Max-chip-GPU-performance_big.jpg.large.jpg
Apple-M4-Max-chip-Media-Engine_big.jpg.large.jpg
 
VideoToolbox does NOT use the GPU on Apple silicon. It uses the Media Engine, dedicated cores created specifically for decoding/encoding.

Yes that's true but it doesn't change the statements made above. Hardware encoding is faster but has worse compression-quality trade-off than good software encoders all else being equal. The T2 chip used in Intel Macs was actually a pretty good encoder and the ones used in Apple Silicon Macs even better. Nonetheless, software-based encoders have better results with the drawback of being much slower (generating more heat, etc).

Also note AMD, Nvidia, and Intel also all have dedicated engines for decoding/encoding -- Nvidia and AMD's cores are of course on their GPU cards but they aren't using the GPU functions to do the encoding as that approach has not proven itself as effective as media-specific hardware.

P.S.galad is one of the Handbrake developers and specifically for Mac so he knows this stuff pretty well...
 
  • Like
Reactions: TzunamiOSX
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.