[ 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.
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.
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.
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.
33 Responses to When To Use H.264 vs. HEVC For Video Compression [u]← Older Comments
Hi Larry. I have a ripped movie in 4K HDR that I need to encode with handbrake. Do you know if I should use H.265 (10bit) or H.265 (12bit)? Let me know if it makes a difference in HDR
Movies use 10-bits for distribution. That would be all you need for conversion. 12-bit is used for shooting, not final distribution.
hi,when testing the 2k image,the time declineing when the QP increasing with the HEVC inter model ,but the time is stable(not declining) when using H264 inter model,I don’t know why? Is the reason of configure in h264?
I’m not fully understanding your question, specifically the term “QP.” It sounds like HEVC is compressing more quickly than H.264, which would be HIGHLY unusual. H.264, single-pass, is hardware accelerated and generally compresses quickly. Only very recent system hardware accelerate HEVC.
Please try asking your question again, if my answer doesn’t help.
Great article again!
Would h.265 be a worthy archiving codec all my cameras are 8-bit h.264 anyway. Would save some space and I have a pretty decent modern PC. These are for those projects I want to keep for posterity but have a low likelihood of editing them again.
If so what would be a good bitrate to transcode at, is there a rule of thumb based on the bitrate of original footage from h.264.
From my perspective, based on what I’m reading, I would archive in high-bit-rate H.264, not HEVC (H.265). HEVC has not really caught on and new codecs designed to replace it are already shipping and gaining market presence. We are a few years away from figuring out what the true successor to H.264 is, but, I suspect, it won’t be HEVC.
If you don’t plan to re-edit, simply archive, use the YouTube settings for H.264 in your favorite compression program. The specific compression setting (bit rate) varies by frame size, frame rate, bit depth, and the amount of movement between frames. So I can’t give you a simple number.
Hi! I posted a video using GoPro Hero 9 with a setting of according to MediaInfo:
MPEG-4 (Base Media/Version) 499 MiB, 1 min 9 secs
1 video stream: HEVC
1 audio stream: AAC LC
3: QuickTime TC
First video stream
60 Mb/s, 2704*1520 (16:9), at 119 880 (120000/1001) FPS, HEVC (Main@L5.1@Main)
Firs audio stream
192 kb/s (48.0 kb/s), 48.0 kHz, 2 channels, AAC LC
When I uploaded it on Facebook, the video was grainy, blurry and somewhat pixelated. What kind of settings or codec do I use? H.265 10-bit, same dimensions and bit rate, etc.? Thanks.
I don’t have a specific answer, but several things leap out at me:
* You are using a non-standard frame size. This forces Facebook to rescale your video. I would, instead, compress your video into 1920 x 1080, using the YouTube presets in your compression software.
* Don’t use HEVC (which is also called H.265). Use H.264.
* You also have a non-standard frame rate (119.8 fps). When you recompress, set it to 60 fps. If you are trying to display slow motion, create the slow motion in your video editing software, then, export a 60 fps master file.
* Facebook doesn’t support 10-bit video – or, if it does, virtually every Facebook user can’t view it. This means that Facebook needs to create an 8-bit version of your video for distribution. This is also where you lose quality control. Instead, create an 8-bit H.264 version of your movie for Facebook.
But!! you say, if I do this, I will lose resolution and bit depth and color quality and all the stuff I work so hard to put into my video!! All true. However, simply because you can record all that image data in the camera, does not mean you can distribute it. Look at all the television programs that were shot on film, yet displayed on standard-definition TV sets.
hi there, is there a simple answer as to whether a 4k h.264 (or h.265) file will be better or worse image quality than a 2k apple prores (or prores HQ) file for posting to online platforms or for general play? thanks!
Sorry for the delay answering this – your question got buried.
If you have the option, use ProRes. Social media always recompresses your video. Starting with ProRes means that the quality of the compressed version will be higher.