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

[ 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:

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:

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:

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 permalink.

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

  1. My feeling is that HEVC has far more accurate color rendition. H264 generally leaves me wanting when I look at the result versus the original file. Not so with HEVC

  2. Clayton Moore says:

    More work then H264 to compress or encode but less work then H264 to decode and playback.

    Having said that, my Panasonic GH5 has a 4k HEVC record setting built right into the camera meant to create Hybrid Log-Gamma. It requires the camera to be re-started to use it …. but WOW highlight roll-offs and general dynamic range are smoooth and …. man it makes pretty files. I apply a LUT for that in FCP (using an OLD) mac and I have a 709 compliant file with NO rendering needed.

    • Clayton Moore says:

      oh yea I forgot to Larry’s point bandwidth wise, it does that (at 24fps in this case) at only just under 64 Mbit/s

  3. Cosmin says:

    I have a Fuji X-T3 setup with 4K DCI HEVC 10-bit internal recording. I am exporting from FCPX as Master File h264 and the exported video files are about 50 Mbit/s.

    Is my logic of shooting HEVC 10-bit and exporting h264 any good? My final clips are personal, family movies for archiving.

    • Larry says:

      Cosmim:

      Well, it isn’t bad. H.264 is only 8-bit, so you lose the value of 10-bit HEVC. On the other hand, you are creating family movies, which are not likely to need excessive effects or color grading.

      The purpose of family movies is to capture memories – any codec you choose will allow you to do that.

      Larry

  4. Pippa Jean Young says:

    Hi Larry,

    Thanks so much for your excellent articles, I have been saved many a time by your advice – your information on sound improvement is so helpful.

    My question is about videos I’m delivering for a client to be broadcast on Vimeo/Wistia. You said that HEVC is not necessary for “social media”, but does that include Vimeo/similar players?

    I’m wondering whether the compression on those players means HEVC is not needed.

    Many thanks!

    Pippa

    • Larry says:

      Pippa:

      See if Vimeo has any specific recommendations. Personally, compressing H.264 at a high bit rate will be faster and better than HEVC. HEVC is for the Vimeos of the world to use for distribution. Until HEVC is seriously hardware-accelerated, it isn’t worth our time to compress.

      Larry

  5. Norris Tidwell says:

    From this article and comments to, I find that my 2019 16″ MacBook Pro using FCP X cannot export HDR movie even though I have clips that are 4K. If so, I find this astounding that I can record 4K on both my iPhone 7 and GoPro Helo8 Black but can only export 8 bit movies.

    • Larry says:

      Norris:

      That’s not a completely true statement. ProRes, which is 10-bit, supports HDR images. In fact all HDR in distribution is 10-bit, even if the camera masters were 12-bit or greater.

      H.264 is only 8-bit, so it can’t be used for HDR. It may be that you have, by accident, selected H.264 for your export, which does not support HDR values.

      HEVC can be either 8- or 10-bit, but 10-bit is required to support the increased grayscale values of HDR. ANY computer can compress 10-bit HEVC. However, if it is done using software, the process is extremely slow. While hardware-accelerated 8-bit HEVC encoding has been around for a while, hardware accelerated, 10-bit HEVC encoding has only been possible in the last 2-3 years.

      Larry

  6. Sjoerd de Vries says:

    Larry,

    You say .h264 is only 8 bit. Why doesn the new Sony A7SIII have .h264 10 bit?
    (For example https://www.dpreview.com/reviews/sony-a7s-iii-review/2)

    • Larry says:

      Sjoerd:

      So far, 10-bit H.264, which is very new, is also widely unsupported. Be VERY careful, before shooting this format, that you have software that can play it back.

      Larry

  7. Leroi says:

    Another benefit of HEVC – due to its smaller file size – is transfer, storage and editing on tablets, phones or new lower-end Mac machines (due to their small SSDs). (There are a few slick video editors available for tablets these days.)

    • Larry says:

      Leroi:

      Not totally correct.

      HEVC is smaller, true. But not easier to edit. It is more computationally complex than H.264. Current hardware, meaning last couple of years, uses hardware acceleration to decompress it for editing. On older systems, though, editing HEVC is dreadful.

      Larry

  8. birdie says:

    What Larry got right:
    – Bitrate is a measure of data used per second of video, so if you have two videos of the same length and you’re using the same amount of data per second they’re going to end up the same size regardless of the codec you use.
    – In most cases, if just uploading to YouTube and deleting the file after, using a high bitrate with the x264 encoder will be your best option given how much faster it is.

    What Larry got wrong:
    — HEVC (h265) was created as the standard for 4K Blu Rays since they needed to fit 4x the pixels of 1080p on a disc only ~2x the size of a regular Blu Ray.
    — While the higher compression of HEVC and other high compression codecs (VP9, AV1) are good for watching video over cell networks, their codec and use case are in no way specific to Cell networks and watching on Cellular devices. As I mentioned before, if you watch those really high 4K Blu Ray discs, they’re using HEVC.
    — HEVC can achieve ~60% of the file size of AVC (h264), though your results will vary depending on the encoder and settings you use
    — HEVC can be useful in any situation where your priority is a smaller file size. While I won’t go through all scenarios, I’ll give a couple exmaples:
    1) You’re a daily vloger and are making somewhere remote (a cabin in the woods) and are using a decent computer but don’t have poor upload speeds; the extra encoding time might be worth it to have a much shorter upload time.
    2) You’re hosting your Videos/BluRays on a Plex server for family and friends; the smaller size might make the encoding time worth it so more people can watch at once.
    — AVC/h264 does support HDR and has for years; It is not “very new”. Most devices don’t support hardware acceleration of its decoding, but it can still be decoded in software (by your CPU). If you’re just uploading to YouTube and want HDR then AVC is fine.

    For most people AVC will be all they ever need, but I just wanted to comment since saying “HEVC was designed for cellular networks, and that’s its only application” is terribly inaccurate.

    • Larry says:

      Birdie:

      Thanks for your comments.

      HEVC has a lot of benefits in distribution, not just cell networks. If I said that, I was being too restrictive. The driving force behind HEVC, initially, was to find a way to cut bandwidth by 50% while still retaining image quality. This would benefit cell networks, streaming video, and any format where smaller file sizes are helpful.

      However, while Blu-ray Disc players are required to support MPEG-2, H.264 and SMPTE-VC-1, according to Wikipedia, Blu-ray Discs do not support HEVC.

      Larry

      • Birdie says:

        Hi Larry,

        HD BluRay discs use h.264 (AVC) while 4K/UHD BluRay discs use h.265 (HEVC). While you’re correct in saying that compression is good for cellular networks, UHD BluRays were the driving force behind the development behind the codec.

        h.264 and h.265 were developed and released right before the Blu Ray Disc Association finalized the HD and UHD BD standards respectively, in order to win the contract for their encoding. HEVC was developed jointly by Mitsubishi, who is actually on the Blu Ray Disc Association, and NHK who is a broadcaster that releases their content on UHD Blu Ray.

        VP9 and AV1, on the other hand, were developed specifically for streaming video and is the primary codec used by companies like Google (YouTube) and Netflix.

        And needing good compression is not specific to cellular networks, as there are tons of people outside of major city centers that don’t have access to 25+ Mbps connections. The type of device you’re watching on plays little to no role in what codec is needed (asides from being able to decode it).

  9. Tom Allen says:

    I recently completed a project that’s 8K at 30 fps for VR. The differences between h264 and h.265 (hevc) are astounding with regards to playback. I simply cannot get the type of detail in h264 than that of h.265. Yes,there certainly is a price to pay in terms of the time it takes to convert an 8k file. It’s roughly 6.8 hours for h265 vs 45 mins for h264. And, as an attempted antidote, certainly I could take the time to make a larger h264 file with higher-quality, but I would never get the playback in real time in the VR headset (currently the Quest 2), in fact the h264 would still fail playback even at less quality. H265 is a lifesaver.

    • Larry says:

      Tom:

      This is a great comment and an area where I don’t current work. Thanks for sharing.

      Larry

    • Robin says:

      I did some testing and came to the conclusion that for 1080p there’s not much size difference and so H.264 works just as well. For 4k video the compression really starts making a difference and for archival of personal family videos it’s worth saving the space and money and iCloud subscriptions (depending on the machine you’re working on)

      • Larry says:

        Robin:

        Thanks for your tests and comments. Just a note. If you plan to edit a video, I would recommend not compressing it into HEVC. But, for archiving, it’s an excellent format.

        larry

Leave a Reply

Your email address will not be published. Required fields are marked *

Larry Recommends:

FCPX Complete

NEW & Updated!

Edit smarter with Larry’s latest training, all available in our store.

Access over 1,900 on-demand video editing courses. Become a member of our Video Training Library today!

JOIN NOW

Subscribe to Larry's FREE weekly newsletter and save 10%
on your first purchase.