Basic concepts:
I frame: the intra-frame encoding frame is also called intra picture. I frame is usually the first frame of each GOP (a video compression technology used by MPEG) and is moderately compressed, as a reference point for random access, it can be used as an image. I frame can be seen as a product after an image is compressed.
P frame: the Forward prediction Encoding Frame, also known as predictive-FrameBy fully compressing the time redundancy information lower than the previously encoded frames in the image sequence, the encoded images that transmit the data volume are also called prediction frames;
B frame: bidirectional prediction interpolation Encoding Frame, also known as bi-directional interpolated prediction frame, not only considers the encoded frame prior to the source image sequence, the time redundancy information between encoded frames after the source image sequence is also taken into account to compress the encoded images that transmit data volumes, also known as bidirectional prediction frames;
PTS: presentation time stamp. PTS is used to measure when decoded video frames are displayed.
DTS: Decode time stamp. DTS mainly identifies when the bit stream in the memory is read into the decoder for decoding.
The sequence of DTs and PTS should be the same without B frames.
Different IPB frames:
I frame: You can decompress the image into a complete image by using the video decompression algorithm.
P frame: refer to an I frame or B frame to generate a complete image.
B frame: refer to the previous I or P frame and the next P frame to generate a complete image.
A GOP is formed between two I frames. In x264, The BF size can be set through parameters, that is, the number of B between I and P or two p.
Based on the above, it can be indicated that if B frame exists, the last frame of GoP must be p.
Difference between DTs and PTS:
DTS is mainly used for video decoding and is used in the decoding phase. PTS is mainly used for Video Synchronization and output. used in display. without B frame. the output sequence of DTs and PTS is the same.
Example:
The following is an example of a GOP of 15. The decoded frame and its decoding sequence are all in it:
For example, I frame decoding does not depend on any other frames. the decoding of P frame depends on the I frame or P frame above it. the decoding of B frame depends on the nearest I frame or P frame and the nearest P frame.