Relationship between I-frame, B-frame, P-frame, DTS and PTS (transfer)

Basic concepts:

I frame: intra coded frame, also known as intra picture. I frame is usually the first frame of each GOP (a video compression technology used by MPEG). After moderate compression, it can be used as a reference point for random access and can be used as an image. I frame can be regarded as the product of an image after compression.

P frame: forward predictive coding frame, also known as predictive frame, compresses the encoded image with the amount of transmitted data by fully compressing the time redundancy information lower than the previous encoded frame in the image sequence, also known as predictive frame;

B frame: bi directional predictive interpolation coding frame, also known as bi directional interpolated prediction frame, which compresses the encoded image with the amount of transmitted data by considering both the encoded frame in front of the source image sequence and the time redundancy information between the encoded frames behind the source image sequence;

PTS:Presentation Time Stamp。 PTS is mainly used to measure when decoded video frames are displayed

DTS:Decode Time Stamp。 DTS mainly identifies when the bit stream read into memory starts to be sent to the decoder for decoding.

When there is no B frame, the order of DTS and PTS should be the same.

Different IPB frames:

I frame: it can be decompressed into a single and complete picture through the video decompression algorithm.

P frame: you need to refer to an I frame or B frame in front of it to generate a complete picture.

B frame: generate a complete picture by referring to its previous I or P frame and its subsequent P frame.

A GOP is formed between two I frames. In x264, the size of BF can be set through parameters, that is, the number of I and P or B between two P.

It can be basically explained from the above that if there is a B frame, the last frame of a GOP must be P

Differences between DTS and PTS:

DTS is mainly used for video decoding. It is used in the decoding stage. PTS is mainly used for video synchronization and output. It is used in display. In the absence of B frame, the output order of DTS and PTS is the same

example:

The following is an example with a GOP of 15. The decoded reference frame and its decoding order are all in it:

As shown in the figure above: the decoding of I frame does not depend on any other frame. The decoding of P frame depends on the previous I frame or P frame. The decoding of B frame depends on the previous nearest I frame or P frame and the subsequent nearest P frame

Scan wechat, pay attention to the 90 diary and get more relevant information and source code -- although it doesn't face the sea, it's still blooming in spring

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>