When To Use H.264 vs. HEVC For Video Compression [u] | Larry Jordan

When To Use H.264 vs. HEVC For Video Compression [u]

Posted on

by

[ UPDATED: Dec. 27, 2020, with information on Apple M1 & T2 chips for media compression, along with a better explanation of when HEVC compression makes sense for media creators. ]

Richard Deeble recently asked:

I have a 2017 Retina iMac, running Mojave and have a question relating to H.264 and HEVC.

I created a 4K 30 fps project, 4:12 in duration, using Rec. 709 color space. When I use Compressor to compress the video:

  • H.264, with a 15 Mbps compression bit rate, took just under 2 minutes to compress. It created a 484 MB compressed file.
  • HEVC, with a 15 Mbps compression bit rate, took about 1 hour and 20 minutes to compress. It created a 487 MB compressed file.

I can’t see any obvious advantage of using HEVC. Can you advise me?

Larry replies: These are great questions, but the answer is complex. Let’s start with the easiest: compressed file size.

FILE SIZE

In general, file SIZE is almost totally determined by bit rate. So, two files with the same bit rate will be pretty much the same size, as Richard reported. However, while those files will be the roughly the same size, they won’t necessarily have the same image quality.

Because image QUALITY is based upon six factors:

  • Codec
  • Video bit depth (8-, 10- or 12-bit)
  • Compressed frame size
  • Compressed frame rate
  • The amount of movement between frames
  • Compression bit rate (Kbps or Mbps)

For this reason, you can’t compare compressed files solely on final file size.

COMPRESSING 4K

This screen shot illustrates that Apple Compressor can create H.264 files for social media up to 4K in size.

NOTE: UHD is 3840 x 2160 pixels. “True 4K” is 4096 by up to 2304 pixels; though more generally 2160.

And this screen shows social media compression settings in Adobe Media Encoder.

Both these popular apps can compress 4K images using the H.264 codec.

So, why use HEVC?

HEVC CREATION STORY

HEVC was created to solve a problem with cellular networks – they were drowning in video. Cellular was first invented to carry voice (audio) and, a bit later, text. Both these files, when compared to video, are small.

However, as phones got smarter and video became more pervasive, we started watching more video. Not just on our TV sets or computers, but on mobile phones and iPads. This put a tremendous burden on the cell networks, which weren’t designed for this level of data traffic.

HEVC (originally called H.265) was invented to help solve this problem. HEVC was designed so that a file with 30% lower bit rate would display the same image quality as an H.264 file at the higher bit rate. This means that if everyone sending files over cell networks used HEVC for all their movies, the cell networks would have 30% more bandwidth available to support more users or more data traffic.

My research has shown this to be a reasonably true statement: a video created using HEVC at a lower bit rate has the same image quality as an H.264 video at a higher bit rate.

The problem is that, for most of us, this isn’t relevant.

Why? Because we are not supplying media directly to cell networks. Instead, we are uploading files to YouTube or Facebook or Vimeo or Twitter. Behind the scenes these social media giants are automatically converting the file we send them into a variety of different codecs and formats for all the different ways we view video today.

NOTE: A couple of years ago, I counted the number of codecs that YouTube converted our videos into. It came to 20 different formats for each video! This is what’s happening when YouTube displays its “Processing” dialog after you upload a file.

UPDATE: WHY USE HEVC – PART 2

There are, however, two good reasons to use HEVC, rather than H.264, when compressing media:

  • HEVC supports frame sizes larger than 4K, H.264 does not.
  • HEVC supports 10-bit depth media, which is required for compressing HDR (High-Dynamic Range media). H.264. does not.

For these two reasons, especially as we move into greater distribution of HDR media, HEVC will become increasingly important.

WHY DOES IT TAKE SO LONG TO COMPRESS HEVC VIDEO?

HEVC is a highly-compressed format. This means that the math involved is very complex and takes a long time to calculate. It uses “asymmetrical compression,” meaning it takes a long time to compress so that playback can be viewed in real-time.

To speed this compression process, modern Intel CPUs support 8-bit hardware acceleration for both H.264 and HEVC video formats. What this means is that compression is done in hardware, which is about ten times faster than software. But, 8-bit doesn’t support HDR.

As well, HEVC is such a new format that older systems don’t support hardware acceleration because HEVC wasn’t invented when those chips were designed. Still, even with hardware acceleration, HEVC compression for both Compressor and AME takes anywhere from 10-40% longer than H.264, depending upon the source codec and compression settings.

NOTE: Here’s a detailed article comparing compression speeds for H.264 and HEVC using Apple Compressor and Adobe Media Encoder. (This chart was compiled prior to the release of the Apple T2 chip.)

UPDATE: APPLE CHANGES THE RULES WITH NEW CHIPS

Prior to Apple releasing the AfterBurner, T2 and M1 chips, hardware acceleration was limited to 8-bit H.264 files using Intel CPUs.

Afterburner, while it sped media transcoding is ProRes only.

However, the new M1 chip from Apple (part of the three new Macs launched in November, 2020) can accelerate encoding of H.264, 8-bit HEVC, and 10-bit HEVC using hardware. This vastly speeds compression of these codecs.

As well, recent Intel-based Mac computers that include the T2 chip can also use it to hardware accelerate both 8-bit HEVC and 10-bit HEVC encoding.  (The T2 chip architecture is included as part of the M1 chip.)

In Apple Compressor, hardware acceleration is always single pass. Enabling multi-pass turns off hardware acceleration. As well, make sure to select the “Faster” compression option.

Adobe Media Encoder has two Bit Rate settings that can turn off hardware acceleration: CBR and VBR 2-pass. For fastest compression be sure to always select VBR 1-pass.

NOTE: In the past, we used 2-pass software compression because it created files that looked better. Based on my observations, using today’s CPUs, hardware-accelerated compression looks as good as, or better than, media compressed using software. And it gets done a WHOLE lot faster!

WHAT SHOULD WE DO?

If you are sending files to social media, use H.264 at a high bit-rate – say 15 Mbps. Since your files will be recompressed once the upload is complete, there’s no reason to waste time compressing HEVC and the higher bit rate gives the social media platform extra data to work with during compression.

If you are sending files that will be delivered directly to viewers over the Internet and they are not on cellular devices, H.264 is also fine, because when computers access the web, they are not using cell networks in most cases.

You only need to create HEVC files if you need to create a compressed HDR file for distribution – or – when the files you create will be viewed directly on cellular devices, without first going through a social media site. And, unless you are running your own website, this second situation will be rare.

While using HEVC can save upload time by creating smaller files, the time we save uploading is more than likely offset by taking longer to compress the media files in the first place.

SUMMARY

HEVC is essential for final distribution of HDR media files or any files sent over cell networks. It reduces data traffic while maintaining image quality. All modern browsers support HEVC.

However, for media creators uploading files to social media, there’s no big benefit to using HEVC. Yes, the uploaded file is smaller, but the additional compression time may not be worth the trade off.

Files created for broadcast, cable, digital cinema or OTT services use codecs other than H.264 or HEVC, so for media creators producing files for these distribution outlets, the question of HEVC is not relevant.

As always, share your thoughts in the comments.

Bookmark the

Bookmark the permalink