api.video
SearchCtrl K

Features

Developers

Glossary

All things video.

Full glossary

H.265

What is the H.265 video codec?

H.265 is a video compression standard that offers 25-50% better data compression than H.264 while maintaining the same level of video quality. To achieve this incredible improvement, it extends on concepts found in the H.264 codec. A key difference from AVC (or H.264) is that H.265 uses more types of transforms and block sizes to achieve compression. H.265 is a fantastic choice if you want to stream and display high resolution video like 4K or higher.

How does the H.265 video codec work?

The H.265 video compression codec works by improving upon techniques that made H.264 so good. Recall that for the H.264 codec, video frames are broken into blocks. Each block is referred to as a macroblock, and these can vary in size. In the H.264 codec, blocks can range from 16x16 to 4x4 depending on the part of the compression process. The encoder makes a guess about what will happen in each block using intra and inter frame prediction Intra frame prediction happens within the same frame of video. The encoder tries to guess from surrounding pixels what will be present. Inter frame prediction looks at surrounding frames to determine what the difference is between the current frame and surrounding frames.

Whether intra or inter prediction is being used at a given time, the encoder always breaks information into blocks. A big deal for the H.264 codec was the encoder being able to choose blocks of different sizes. For inter frame prediction, the encoder can choose blocks ranging from 16x16 to 4x4. For intra frame prediction, blocks are usually either 4x4 or 16x16 pixels wide.

All of this changes with the introduction of the H.265 codec. In the H.265 codec, discrete cosine transform (DCT) is used for pixel blocks of 4x4 and 8x8. However, this codec ups the ante by ALSO using discrete SINE transforms (DST). It transforms block sizes from 4x4 to 32x32. This is for inter prediction. For INTRA prediction the H.265 codec can handle blocks of up to 64x64 pixels! These are more efficient ways of compressing the data, resulting in an up to 50% better data compression rate while still maintaining the same level of video quality or better.

What is the difference between H.265 and H.264?

There are a number of differences between H.265 and H.264 codecs, here's a list:

  1. H.264 is used almost everywhere in the world for video and can play on almost any browser. H.265 on the other hand only plays in about 18% of browsers.
  2. For inter prediction, H.264 uses blocks ranging from 16x16 to 4x4. H.265 uses blocks that range from 32x32 to 4x4.
  3. For intra prediction, H.264 uses blocks that are either 16x16 or 4x4 pixels wide. H.265 can use a complete range of blocks from 64x64 pixels all the way to 4x4.
  4. H.265 can compress data up to 50% as much as H.264 without reducing quality.
  5. H.265 uses less bandwidth than H.264, allowing for higher quality video.

Which is better: H.264 or H.265?

If you want to be sure your video plays when you send it out across the internet, you choose H.264. While it's not as efficient a codec, it's free and browsers nearly everywhere support the decoder for H.264. If you can afford to use H.265 (it's not free) and you know you're going to use a player that can handle H.265, then H.265 is the best choice. You will run into an issue with browsers still, because many browsers don't support H.265 due to the cost. While H.265 is great, it's also patent encumbered, driving up its cost of use.

Over time, a new codec will replace both these options. There are a few options in the works that will allow for a super efficient, high quality codec that's free and plays on every device. Some examples are H.266, VP9 and AV1, but one has not yet emerged as the leader. VP1 and AV1 are competitors with one another and H.266 is the next generation of H.265. All promise to be less patent encumbered and free. We'll just have to wait and see!