MPEG-2 Video compression standard (also known as H.262 or MPEG-2 Part 2) was released in 1995. This standard is very similar to MPEG-1 but provides some extra features. MPEG-2 Video is backward compatible with MPEG-1 Video. So MPEG-2 Video decoder can decode every MPEG-1 Video bitstream. In the article we will show the location of some parameters of the original video (FPS, frame size, aspect ratio, profile, level and scan type) in encoded MPEG-2 Video elementary stream. To analyze MPEG-2 Video we will use Virinext Bitstream Analyzer. You can download the evaluation version on the Download page. For license acquiring please check the Buy license page.
As an example we will use the file with parameters in the screenshots below.
Frames per second (FPS)
Frame rate is calculated based on frame_rate_code from the Sequence header and frame_rate_extension_n and frame_rate_extension_d from the Sequence extension. When the Sequence extension is not present in bitstream both frame_rate_extension_n and frame_rate_extension_d are considered equal to 0.
Frame rate is calculated by the following formula:
frame_rate = frame_rate_value * (frame_rate_extension_n + 1) / (frame_rate_extension_d + 1)
Frame_rate_code from the Sequence header is converted to frame_rate_value according to the following table:
In the example file we have frame_rate_value = 3, frame_rate_extension_n = frame_rate_extension_d = 0, so frame_rate is 25 frames per second.
Picture size
Picture width and height both are 14 bit values, the 12 least significant bits are stored in horizontal_size_value and vertical_size_value from the Sequence header and the 2 most significant bits are defined in horizontal_size_extension and vertical_size_extension in the Sequence extension.
In the example file horizontal_size_extension = vertical_size_extension = 0. As a result in this file the picture size is calculated from horizontal_size_value and vertical_size_value and equals to 720×608.
Aspect ratio
In MPEG-2 Video the aspect ratio is calculated based on the aspect_ratio_information field from the Sequence header according to the following table:
In the example file aspect_ratio_information = 3, so the picture Display Aspect Ratio is 9:16.
Profile and level
Profile defines the features that the encoder can use during encoding. Based on the profile value, the decoder can recognize the requirements for decoding specific bitstream. Level specifies another set of constraints that indicate a required decoder performance. These constraints include maximum frame size, bitrate and decoding speed. Profile and level are described by the profile_and_level_indication field in the Sequence extension.
When profile_and_level_indication starts with bit 0, the next 3 bits describe profile and last 4 bits describe level according to the following tables:
When profile_and_level_indication starts with bit 1 the following table is used:
In the example file profile_and_level_indication = 133 = 10000101. That means file is encoded with 4:2:2 profile and Main level.
Scan type
The value progressive_sequence in the Sequence header carries the information about progressive/interlaced scan type used during encoding. The value progressive_sequence equals to 1 indicates that encoded bitstream contains only progressive frames and doesn’t have codec fields or interlaced frames. The progressive_sequence equals 0 means both frames and fields can be used in bitstream and frame-picture may be progressive or interlaced frames.
The type of picture is described by the picture_structure value in the Picture coding extension and interpreted according to the following table:
When progressive_sequence = 0 and picture_structure = 3 the order of fields is described by the top_field_first value in the Picture coding extension.
In the example file progressive_sequence = 0 and picture_structure = 3, that means file is encoded as interlaced frames.
Conclusion
We have described the location of a some parameters of video in encoded video elementary bitstream. MPEG-2 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 MPEG-2 Video.