What are B-Frames and how are they used?

B-frames are a unique type of frame used in video codecs. They are found in video compression formats like H.264/AVC, HEVC, and AV1. You can think of them as helping to define the intermediate state of frames in a sequence. They contribute a lot to reducing the size of video files. However, if they do their job poorly, they can reintroduce visual artifacts, leading to a subpar experience for the viewer. So, their correct implementation is of the utmost importance.

Using B-frames in video compression

B-frames make use of information from both the previous and next frames in the Group of Pictures (GOP) to achieve highly efficient compression. There is a very good and logical reason why encoding systems such as H.264/AVC and its successors use both past and future information in this way. This can be seen in the context of video compression in a fairly simple situation: a long shot that moves across a fairly unchanging, static background (low motion) that is to be compressed and saved.

This can be contrasted to the I-frames (whole, static images) and P-frames (predicted from the previous frame), where only the current or the previously seen frames are used as references.

Advantage of using B-frames

Several video compression situations demand the use of B-frames, which are very useful.

Filesize reduction: B-frames are a must-have for streamlining the file size and bandwidth necessity of streaming services. They are as important to Netflix, YouTube, Stage, ShareChat, Rakuten Viki, Hudl, and every video streaming provider. That’s because B-frames perform a key role in the video compression process of these services.

Applications with reduced storage: Applications that are limited in storage space can use B-frames to compress video files by a significant amount without causing a severe reduction in quality. This is particularly significant in cases of embedded systems or mobile devices where space may be at an absolute premium.

Low-motion conditions: The videos in which B-frames work the most efficiently are not only the ones with slow or smooth movement but also the ones with an impressive quantity of frames common to one or more adjacent frames.

Drawbacks of using B-frames

Even though B-frames are very useful in video compression, they are not perfect and have their drawbacks.

Computational Complexity: Decoding B-frames is computationally tougher than P-frames and I-frames, mainly because B-frames are constructed from multiple reference frames. This is mainly a problem for devices with limited processing power.

Video Editing: The integration of B-frames while editing might create certain challenges. These challenges arise from the very nature of B-frames. They heavily rely on previously and subsequently seen frames, which, in the context of GoP (Group of Pictures) structure, means things can go wrong when editing that could affect the visual appearance of the video. Also, re-encoding of the entire sequence might be necessary to maintain video integrity. Editing with B-frames certainly works, but one must proceed with caution.

Live streaming: Live-streaming apps that need really quick response times aren’t good candidates for B-frames. That’s because the current B-frame can’t be displayed until the reference frames that precede it have been decompressed and sent to the video decoder. Lives streaming with B-frames, then, introduces a delay that plain-old P-frames don’t have.

Video buffering and stalls: Buffering is significantly increased when it comes to B-frames. They depend on several more frames, and so they require all of those to be loaded into memory to carry out all of their necessary referential checks and calculations.

The B-frames tool is vital to video compression. Codecs such as H.264/AVC, HEVC, and AV1 use these frames to get the best results. Those results involve the ratio of compressed file size to the visual quality of the video.

If you are interested in video compression, you’ll enjoy this article where we talk about the use of AI and ML in video compression.