In video compression, each frame represents a delicate image. In actual compression, various algorithms are used to reduce the data capacity. IPB is the most common one.
To put it simply, I frame is a key frame and belongs to intra-frame compression. It is the same as avi compression. P indicates the forward search. B is a bidirectional search. They all compress data based on I frames.
I frame indicates the key frame, and you can understand it as the full retention of the frame image. decoding only requires the data of this frame to be completed (because it includes the complete image)
P frame represents the difference between this frame and the previous key frame (or p frame). During decoding, the difference between the definition of this frame must be superimposed on the cached image, generate the final image. (That is, the difference frame. P frames do not have complete screen data, but only have data different from the previous frame)
Frame B is a two-way differential frame, that is, frame B records the difference between the current frame and the front and back frames (details are more complex than the second frame, there are four situations). In other words, to decode frame B, not only do you need to obtain the cached image, but you also need to decode the image and stack it with the data of the current frame to obtain the final image. The B-frame compression rate is high, but the CPU will be more tired when decoding ~.
From the above explanation, we know that the I and P decoding algorithms are simpler than the limit, and the resource usage is also less than the limit. I just need to finish it myself. What about P, the decoder only needs to cache the previous image and use the previously cached image when P is encountered. If the Video Stream only has I and P, the decoder can ignore the subsequent data, while reading and decoding, linear advances, everyone is very comfortable.
However, many movies on the network use B frames. Because B frames record the difference between the front and back frames, it can save a lot of space than P frames, but in this way, when the file is small, the decoder is in trouble. Because not only the previously cached image is used for decoding, but also the next I or P image (that is, pre-read and pre-decoding is required, frame B cannot be simply discarded. Because frame B actually includes the image information, it is assumed that frames B are simply discarded, and the previous image is simply repeated, in fact, frames are dropped. In order to save space, movies on the network usually use a large number of B frames and many B frames, this will cause more troubles for players that do not support B frames, and the picture gets stuck.
Generally, the I compression ratio is 7 (almost the same as JPG), P is 20, and B can reach 50. It can be seen that using B frame can save a lot of space, the saved space can be used to save more I frames, so as to provide better image quality at the same bit rate.
The following is an example:
For example, GOP (Group of pictures) has a length of 13 and S0 ~ S7 indicates eight viewpoints, t0 ~ T12 is the 13 time points of GOP. Each GOP includes the product of the number of frames as the GOP length of the viewpoint. In this figure, a GOP contains 94 B frames. Frame B occupies 90.38% of the total number of frames of a GOP. The longer the GOP, the higher the proportion of B frames, and the higher the encoding rate distortion performance. Comparison of the rate distortion performance of the trial series race1 in different Gop.
What is I frame, P frame, and B frame?