Click here to Skip to main content
15,884,353 members
Articles / Multimedia / Video
Tip/Trick

The Structure of HEVC Video

Rate me:
Please Sign up or sign in to vote.
4.71/5 (6 votes)
12 Apr 2015CPOL3 min read 77.4K   2.9K   5   8
This tip is about HEVC, HEVC syntax elements and opensource tool for analyzing HEVC bitstreams.

Introduction

This tip is about HEVC(h265) video bitstream syntax. In this tip, you will find information about the main elements of the HEVC video. The places of some aspects of the original video (fps, size, aspect ratio) in encoded HEVC bitstream will be shown. Only high-level elements are reviewed. It can be interesting for beginners in HEVC and video compression in general.

To analyze the HEVC video, we will use HEVCESBrowser. HEVCESBrowser is the open source tool to display syntax elements of the encoded HEVC files.

Main HEVC Syntax Elements

Image 1

HEVC bitstream is an ordered sequence of the syntax elements. Each syntax element is placed into a logical packet called a NAL (network abstraction layer) Unit. There are 64 different NAL Unit types. They can be grouped into 10 classes:

  1. VPS - Video parameter set
  2. SPS - Sequence parameter set
  3. PPS - Picture parameter set
  4. Slice (different types)
  5. AUD - Access unit delimiter
  6. EOS - End of sequence
  7. EOB - End of bitstream
  8. FD - Filler data
  9. SEI - Supplemental enhancement information
  10. Reserved and unspecified

VPS, SPS and PPS contain general video parameters. They provide a robust mechanism for conveying data that are essential to the decoding process. They can be either a part of bitstream or can be stored separately.

Slice NAL unit contains data from encoded video frame. It can contain full frame or its part. Each slice can be decoded independently, that is, without using information from any other slice. Thereby, slices can be used as a tool to support parallel encoding/decoding.
There are following slice types:

  1. I-slice - slice with only intra prediction
  2. P-slice - slice with inter prediction from one I or P slices
  3. B-slice - slice with inter prediction from two I or P slices

There is one special slice type called IDR-slice. There are no references from slices after IDR-slice to slices before it.

AUD can be used for signaling about start of video frame.

FD can be used for bitrate smoothing.

SEI provides support for different types of metadata. It includes picture timing, color space information, etc.

Image 2

This image is the conventional structure of HEVC bitstream. It starts with VPS, SPS and PPS elements. IDR slice follows them. Then there is P slice, after which there is a group of B slices, then again P, then B, etc.

Some Aspects of Original Video in Encoded HEVC Bitstream

Used further files: the_structure_of_hevc_video.zip

Frame per second value

Information about FPS is placed in sps:vui:num_units_in_tick, sps:vui:time_scale and vps:num_units_in_tick, vps:time_scale. FPS in SPS and VPS can be present together, one of them or neither.

FPS = sps:vui:time_scale / sps:vui:num_units_in_tick = vps:time_scale / vps:num_units_in_tick

Image 3

For this file FPS = 24000 / 1001 = 23,97

Size of picture

Size of picture is stored in sps:pic_width_in_luma_samples and sps:pic_height_in_luma_samples.

Image 4

In this example, size of original video frame is 1920x800.

Aspect ratio

Aspect ratio can be present as predefined constant or as a pair of horizontal and vertical values. Aspect ratio value is placed into sps::vui::aspect_ratio_idc. If sps::vui::aspect_ratio_idc==EXTENDED_SAR then sar_width and sar_height are used.

Predefined value is used in foreman_cif_sar2.hevc. For this file sps::vui::aspect_ratio_idc=2. Aspect ratio is 12:11.

Image 5

The pair of sizes is used in foreman_cif_128-117.hevc.

Image 6

The aspect ration of the original file is 128:117.

References

  • HEVCESBrowser [https://github.com/virinext/hevcesbrowser]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHEVC NAL Header Pin
Member 1499390615-Nov-20 20:07
Member 1499390615-Nov-20 20:07 
QuestionI have a question that packet contents after parsing using browser. Pin
Member 1205698820-Nov-18 18:58
Member 1205698820-Nov-18 18:58 
AnswerRe: I have a question that packet contents after parsing using browser. Pin
virinext25-Nov-20 9:47
virinext25-Nov-20 9:47 
QuestionA question about the parser itself Pin
aquila_prosperus2-Apr-17 23:00
aquila_prosperus2-Apr-17 23:00 
QuestionCTU location in HEVC bitstream Pin
Member 130333539-Mar-17 4:01
Member 130333539-Mar-17 4:01 
QuestionWhere do we find the Motion vector data in HEVC bitstream? Pin
Member 1184196216-Sep-16 2:36
Member 1184196216-Sep-16 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.