Glossary

What are I-Frames (IDRs) and how are they used?

I-frames (intra-coded frame) play a very important role in video compression and in this article, we shall see why exactly.

Unlike the P-frame (predictive-coded frame), which codes only the differences from the previous frame, and the B-frame (bi-predictively coded frame), which codes the differences from both the previous and following frames, the I-frame itself is coded as if it were an individual complete image. Read more about B-frames and P-frames that we wrote earlier.

The I-frame doesn’t refer to other frames for information, and because of this feature, it plays a critical role in video compression. They are found in video codecs like H.264/AVC, HEVC, and AV1.

Why are I-frames used in Video Compression?

Consider a video where scenes are cut together haphazardly – without a lot of continuity between the frames or scenes. Since the frames/scenes do not have much similarity or redundancy between them, inter-prediction algorithms such motion estimation and compensation will not be able to reduce the file size effectively while staying within the bitrate constraints. It is important to encode such frames individually using information from that particular frame only – i.e., intra-coding.

So, a frame that is entirely intra-coded is called an I-frame.

However, I-frames are bigger than B-frames or P-frames, meaning they require more data and storing them can have a greater effect on video file size than these other frame types.

To achieve the best combination of file size and quality, video codecs use a wise sequence of frames. The time between major frames – also known as the Group of Pictures (GOP) is crucial for making good trade-offs among coding efficiency, random-access capability, and the visual quality that viewers pay closest attention to. Read more about GOPs in this blog we wrote earlier.

Use cases of I-frames

Random Access

Another need in today’s streaming world is random, and very fast access to any point of the movie. This means that need to be able to access any point of the movie without waiting for things to be decompressed or for a predecessor/preceding frame to be downloaded or decompressed. The need for fast, efficient access to individual sections of media is something VOD (video on demand) services, video tutorials, and general educational content all have in common.

This, of course, has a highly precise following/accompanying frame, but in video-on-demand (VOD) applications, particularly when you rewind or fast-forward through a movie, it is a much more pleasant experience when I-frames are used and placed strategically.

Video Playback Synchronization

Serving as reference points, I-frames enable smooth video playback. When there are streaming errors or transmission glitches, the decoder stays in sync with the video, using I-frames as the basis for reestablishing synchronization. These I-frames are typically referred to as IDR or Instantaneous Decoder Refresh frames).

Ease of Editing

I-frames can be easily edited because they are independent units. This means that you can insert, delete, or change the contents of an I-frame without causing the decoding of the next P or B frame to be wrong. I-frames are ideal for video editing workflows because they enable editors to easily manipulate video files without affecting the previous and future frames.

IDR - Special Kind of I-frames

I-frames are like individual milestones in a video sequence. But there is something perfectly unique about a certain type of I-frame known as an IDR-frame—short for Instantaneous Decoder Refresh.

An IDR-frame is even more of a clean slate than an I-frame, because it practically says “restart here” to the decoder.

An I-frame, by contrast, only carries enough context to be able to decode itself; it doesn’t signal anything about what came before or what might come after.

In this way, an IDR-frame can serve as a particularly good way to transition between scenes, because it forces even the most sluggish decoders to get to a fresh starting point.

It is very common in OTT streaming applications using streaming protocols like HLS or MPEG-DASH that need a IDR to start each segment of video independently. This in-turn allows a viewer to seek forward and backward seamlessly within a streaming session!

Finally

Finally, the key to video compression lies in the I-frames and its a specialized task to decide the number of key-frames, their placement, and usage while compressing the video as these decisions impact the video quality and video size a lot.

If you are interested in video compression, you will enjoy this technical blog on MV-HEVC, the video codec of choice for Apple’s Vision Pro VR headset.