P-frames, short for Predicted frames, are another crucial type of frame used in video
compression, specifically in inter-frame compression. They are designed to reduce
redundancy between consecutive frames, leading to significantly smaller file sizes compared to
using only I-frames.
Here's a breakdown of what P-frames are and how they work:
What are P-frames?
● Predicted from Previous Frames: Unlike I-frames which contain the complete image,
P-frames only store information about the changes that have occurred from the previous
I-frame or P-frame (which acts as a reference frame or "anchor").
● Forward Prediction: P-frames use forward prediction, meaning they predict the current
frame based on the information from a frame that has already been encoded and
decoded.
● Motion Compensation: To achieve this prediction, encoders use motion estimation
techniques. They divide the current frame into blocks and try to find corresponding blocks
in the reference frame. If a matching block is found (even if it has moved), the P-frame
stores a motion vector indicating the direction and distance of the movement, rather than
re-encoding the entire block.
● Residual Data: If a block has changed in more than just its position (e.g., changes in
color or shape), the P-frame also stores residual data which represents the difference
between the predicted block and the actual block in the current frame.
How P-frames contribute to video compression:
● Exploiting Temporal Redundancy: In most videos, there is a lot of similarity between
consecutive frames. P-frames efficiently exploit this by only encoding the differences,
which are typically much smaller than the entire frame.
● Smaller File Sizes: By storing only motion vectors and residual data, P-frames are
significantly smaller in size compared to I-frames. This leads to much better overall
compression ratios for the video.
● Efficient Encoding: While motion estimation can be computationally intensive, encoding
the P-frame itself (once the motion vectors and residuals are determined) is generally
faster than encoding a full I-frame.
Key characteristics of P-frames:
● Dependence on Previous Frames: P-frames cannot be decoded independently. They
require the information from the preceding I-frame or P-frame to be reconstructed. If a
reference frame is lost or corrupted, it can affect the decoding of subsequent P-frames.
● Less Information than I-frames: P-frames contain less information than I-frames,
focusing on changes rather than the complete picture. When viewed in isolation, a
P-frame would not make sense.
● Building Blocks of Inter-frame Compression: P-frames are a fundamental component
of inter-frame compression techniques used in most modern video codecs like MPEG-4,
H.264, and H.265.
In summary, P-frames are predictive frames that significantly improve video compression
efficiency by only storing the changes (motion vectors and residual data) compared to a
preceding reference frame (I-frame or another P-frame). They are essential for achieving
practical file sizes for video storage and transmission.