EN ES FR

Unsupported Browser

This page probably won't work great in Internet Explorer. We generally only support the recent versions of major browsers like Chrome, Firefox, Safari and Edge.

H.265 or High Efficiency Video Coding (HEVC) is a modern standard for video compression.

H igh E fficiency V ideo C oding

The successor of H.264, H.265 claims to achieve the same level of quality with only half the bitrate.

Usage of H.265

Cameras supporting HEVC video recording have started shipping in 2015 (Samsung NX1, Samsung NX500, Samsung Gear) and in last years, as H.265 encoding chips are becoming mainstream, the HEVC codec is used by many cameras, ranging from low-end to production:

H.265 is a versatile video codec, it can be used in a variety of multimedia formats:

MOV
When used inside MOV file format — iPhone, Lumix S1H, DJI Mavic Pro 2 — H.265 video codec is paired with one or several audio channels.

The video stream doesn't usually contain the VPS, PPS and SPS units, which are encoded in the hvcC structure found inside stsd atom.
See details in “H.265 analysis” section.
MP4
HEVC is implemented inside MP4 containers exactly like it is in MOV files. In Pro cameras, audio format is usually PCM instead of AAC.

The H.265/MP4 combo is used by Lumix GH5, by many screen recording applications and by Sony A7S mark III.
MXF
Canon is the first to wrap H.265 into a MXF file format. Called Canon XF-HEVC, this format is used by the Canon XF705 camcorder.

Stream is encoded as “Annex B” instead of length-prefixed hvcC.

How H.265 encoding works

To explain what happens at high-level, we will simulate a video recording with this Canon EOS R5 camera.

 

  1. Camera configures the HEVC chip using the hvcC corresponding to this mode:
  2. Camera creates an empty DAT file and writes the MP4 header
  3. Images from sensor are ingested by HEVC encoding chip, which yields media data —  the encoded images
  4. Camera writes media data to the DAT file. Not just video, also encoded audio, which is stored interleaved with video in the file
  5. Camera wraps the file by adding the moov database and changes its extension to .MP4

Try Treasured on your corrupted H.265 files!

Our service offers:

  • FREE diagnostics and preview with Treasured
  • FREE sample of repaired video
  • Try before you buy with a FREE trial of your Repair Kit
  • Enjoy FREE customer support by speaking directly with our trained experts
  • Invaluable expertise, dedication and second to none customer service
Video Repair app online

Treasured

Video Repair — online

Mac, Windows, Linux

CLICK TO DOWNLOAD APP
app.aeroquartet.com
Click to try

H.265 analysis

Unlike proprietary codecs, H.265/HEVC is an international standard:
Codec specification is public and we can provide give here a few pointers about how it works.

Anatomy of a H265 movie

We take as example a MP4 file with a H.265 video track.
This information is also valid in case of a MOV file.

Inside a MP4 container, H.265 has the following characteristics:

Header

0000000: 0000 0030 6674 7970 6d70 3432 0000 0000  ...0ftypmp42....
0000010: 7174 2020 6973 6f6d 6876 6331 0000 0000  qt  isomhvc1....
0000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000030: 0000 0008 7769 6465 002a fed3 6d64 7461  ....wide.*..mdta
					

where mp42 indicates MP4 container and hvc1 indicates H.265/HEVC encoding.

Frames

Immediately after mdat tag, we find media data. Here, it starts directly with a H.265 keyframe:

0000040: 000b dd6c 2601 ac6e 4939 bd6c c7f1 da20  ...l&..nI9.l... 
0000050: 4a68 0c7c c8c2 9c5d 6612 eaad d3b7 daf9  Jh.|...]f.......
0000060: eb92 2ca1 b0c2 4f8a 1ede 0541 c938 c684  ..,...O....A.8..

where hexadecimal value 0xbdd6c corresponds to the length of the frame
and the NAL header 0x2601 indicates that this is a keyframe — aka an Intra frame.

Videos made only of such frames are called All-Intra or All-I.
Other values are possible for a NAL header: 0x0201 stands for a Progressive or P frame.

Sample Description

Deep inside the moov database — found either at the beginning of at the end of the .MP4 file — the stsd atom contains the H.265 encoding settings necessary to decode the video.

bbf4fd3: 0000 00ed 7374 7364 0000 0000 0000 0001  ....stsd........
bbf4fe3: 0000 00dd 6876 6331 0000 0000 0000 0001  ....hvc1........
bbf4ff3: 0000 0000 0000 0000 0000 0000 0000 0000  ................
bbf5003: 0f00 0870 0048 0000 0048 0000 0000 0000  ...p.H...H......
bbf5013: 0001 1f44 5249 4d65 5620 4845 5643 2045  ...DRIMeV HEVC E
bbf5023: 6e63 6f64 6572 0000 0000 0000 0000 0000  ncoder..........
bbf5033: 0000 0018 ffff 0000 0074 6876 6343 0101  .........thvcC..
bbf5043: 0000 0006 0000 0000 0000 99f0 00fc fdf8  ................
bbf5053: f800 004f 0320 0001 0018 4001 0c01 ffff  ...O. ....@.....
bbf5063: 0160 0000 0300 0003 0000 0300 0003 0099  .`..............
bbf5073: ac09 2100 0100 2542 0101 0160 0000 0300  ..!...%B...`....
bbf5083: 0003 0000 0300 0003 0099 a001 e020 0220  ............. . 
bbf5093: 7c4e 5ae4 bc12 ea6e 0202 0201 2200 0100  |NZ....n...."...
bbf50a3: 0944 01c0 7292 030c 4190 0000 0013 636f  .D..r...A.....co
bbf50b3: 6c72 6e63 6c78 0001 0001 0001 00         lrnclx.......
					

where hvc1 indicates the codec used,
0x0f00 is the picture width, and 0x0870 the picture height — in decimal 3840 x 2160,
and where the hvcC structure (whose length is 0x74) contains encoding settings, formatted according to the sequence header format:

Tokens 0x40, 0x42 and 0x44 indicate the VPS, PPS and SPS structures, prefixed by their respective length.

Fixing MOV files MP4 files Reindexing

Related Topics

X
X
X

How do we recover corrupted H.265 videos?

Since 2017, Treasured can detect the presence of H.265 media inside a corrupted file or a wiped card, and show a preview of the video.

Repairing the video

At bitstream level, H.265 is structured similarly as H.264. Therefore, repair techniques for HEVC are not very different from what we have been doing with H.264 for over a decade. In other words, all our experience in delivering high-quality, affordable repairs is immediately available for H.265 videos.

We develop a Repair Kit — a program able to fix bad H.265 files — specifically for your videos. The Repair Kit uses an algorithm called Reindexing to yield good video out of unplayable media data.

To fix a corrupt video containing H265, it is sometimes necessary, and always helpful, to have a good file similarly encoded. Even if the good file contains only a few frames, the fact that it was encoded with the exact settings of the damaged clip will provide useful information:

  • Sample description — usually found in the hvcC structure of a stsd atom
  • Distribution of frames between I, P and B types (stsc, stsz, stss tables)
  • Composition offsets, if used (ctts table)
  • Distribution of blocks inside a frame

This information can be guessed from a broken H265 file, but through a lengthy trial-and-error iterative process.