HEVC (also known as H.265 and ISO/IEC MPEG-H Part 2) is a successor of AVC and was released in 2013. At the high level HEVC elementary bitstream is the sequence of NAL Units (Network Abstraction Layer Units).
There are two main ways of storing NAL Units sequence into byte-stream:
- Annex B part of specification describes the way of storing NAL Units with startcode prefix (0x000001). This startcode is added to every NAL Unit. All byte sequences 0x000000 which is located in the middle of NAL Unit are replaced by 0x00000300 to escape startcodes;
- hvc1/hev1 byte-stream formats in which every NAL Unit is prefixed by size of this Unit. VPS, SPS and PPS are stored separately in decoder configuration record (also known as decoder config or codec config). In hvc1 bitstream VPS/SPS/PPS can be stored separately only, hev1 allows to store them in main HEVC content as well.
Annex B is commonly used for live formats like MPEG-TS when there is no way to send metadata separately. For file formats like MP4 and MKV the second approach is used.
HEVC decoder configuration record contains VPS, SPS and PPS NAL Units with extra metadata which describes parameters of elementary bitstream. Format of HEVC decoder configuration record is specified in ISO/IEC 14496-15. Field lengthSizeMinusOne describes length of size block inserted before every NAL Unit. In example file on screenshot lengthSizeMinusOne = 3 which means length of size block is 4 bytes.
Conclusion
We have described HEVC bitstream formats. HEVC video files can be analyzed with Virinext Bitstream Analyzer. It is a GUI tool for both in-depth and high-level analysis for many encoding standards including HEVC video.