Introduction
A .hevc, .h265 or .265 file holds H.265 video
exactly as an encoder produced it, with no container. H.265, also called HEVC (High
Efficiency Video Coding) or MPEG-H Part 2, is defined by ITU-T H.265 and ISO/IEC
23008-2. It is the successor to H.264 and needs about
half the bit rate for the same quality, which made it the usual codec for 4K and HDR
video.
Like a raw H.264 stream, the file has no audio, no index and usually no timestamps. It is used for testing and as a step before the video is put into an MP4, MOV or MKV file.
Structure
The stream uses the Annex B byte stream format: NAL units, each preceded by the start
code 00 00 01 or 00 00 00 01, with emulation prevention
bytes inserted as in H.264. Unlike H.264, each NAL unit has a 2-byte header: a
forbidden bit, a 6-bit nal_unit_type, a 6-bit layer ID and a 3-bit
temporal ID plus one.
Common NAL unit types are 32, the video parameter set; 33, the sequence parameter set; 34, the picture parameter set; 19 and 20, IDR slices where decoding can start; 21, a clean random access slice; 35, an access unit delimiter; and 39 and 40, supplemental enhancement information. A stream normally starts with the VPS, SPS and PPS.
000 00 00 01 start code, then VPS (type 32)varies…00 00 00 01 start code, then SPS (type 33)varies…00 00 00 01 start code, then PPS (type 34)varies…00 00 01 start code, then an IDR slice (type 19 or 20)varies…slices of the following framesrepeated
Links
Software
- FFmpeg and ffplay (Windows, macOS, Linux)
- VLC media player (Windows, macOS, Linux)
- mpv (Windows, macOS, Linux)
- x265, an encoder that writes raw streams (Windows, macOS, Linux)
- GPAC and MP4Box, which puts raw streams into MP4 (Windows, macOS, Linux)
Developers
- libavcodec, C, FFmpeg’s codec library, which decodes HEVC
- libde265, C++, an open HEVC decoder
Reference
- ITU-T Recommendation H.265, the standard, with the byte stream format in Annex B