IDR (Instantaneous Decoder Refresh) and CRA (Clean Random Access) frames are types of IRAP (Random Access Pictures) in video encoding and specifically, the HEVC video codec, that ensure proper video decoding and playback. They serve as reference points for the decoder, allowing the video to start playing from specific points without needing information from earlier frames (in most cases, as we shall see).
This article provides an in-depth analysis of IDR (Instantaneous Decoding Refresh) & CRA (Clean Random Access) pictures, their differences, and their use cases.
Table of Contents
Instantaneous Decoder Refresh (IDR) frames are critical reference frames in video encoding, often used in H.264/AVC and H.265/HEVC codecs. An IDR frame is a self-contained frame that does not require any other frames to decode the image correctly – and it only contains I-slices.
They are also known as I-frames (Intra-coded frames) because they only use intra-frame prediction to compress data. Intra-frame prediction exploits spatial redundancy within the frame, as opposed to inter-frame prediction, which takes advantage of temporal redundancy between consecutive frames.
When the decoder encounters an IDR frame, it can immediately start decoding the video from that point.
IDR frames also have the following properties:
- They serve as reference frames for subsequent Inter-coding (P and B) frames.
- IDRs reset the decoder state, allowing for a clean start in video decoding. This is also referred to as flushing the decoder state and removing all the pictures that have been stored in the decoder buffer.
- IDRs define the beginning of a Group of Pictures (GOP), a sequence of frames starting with an IDR frame followed by inter frames (P and B) that reference it. IDRs, thus, are associated with Closed GOPs – where pictures that follow the IDR cannot refer to pictures that come before the IDR.
Use Case of IDR Frames:
IDR frames are particularly useful in scenarios where random access is crucial, such as video streaming services, video conferencing applications, and broadcast television. They allow users to seamlessly start playback from any point in the video, enable fast-forwarding and rewinding, and facilitate error recovery if the video data is lost or corrupted during transmission.
Clean Random Access (CRA) pictures, introduced in the H.265/HEVC codec, are similar to IDR frames but with a slight difference.
While they allow the decoder to start decoding from that point, they do not reset the decoder state entirely (unlike, IDR Frames that cause the decoder to be flushed).
Instead, CRA frames reference other frames within the same decoding session, preserving some information from the previous GOP. This feature, referred to as an “Open GOP” can be beneficial in reducing the bitrate, as CRA frames often require fewer bits to represent the same image quality compared to IDR frames.
By preventing the decoder from being flushed, the CRA frames allow decoders to keep using reference frames from before the CRA frame for subsequent inter-coded frames, which improves compression efficiency.
This characteristic allows CRA frames to provide better overall compression performance than IDR frames in some scenarios and allows for random access.
Use Case of CRA Frames:
CRA frames are well-suited for applications where improved compression efficiency and random access capabilities are essential, such as adaptive bitrate streaming, where video quality needs to be dynamically adjusted based on available bandwidth. CRA frames enable seamless switching between different quality levels without abrupt visual artifacts.
Differences Between IDR & CRA frames
Random Access Level
IDR frames provide the highest level of random access, as they allow decoders to start decoding from any IDR frame without the need for prior frames. CRA frames also offer random access capabilities but maintain a “clean” state by not mandating the discarding of reference frames.
IDR frames are the least efficient in terms of compression, as they only use intra-frame prediction and are self-contained.
CRA frames improve upon IDR frames by allowing the continued use of reference frames, leading to better compression performance.
IDR frames can also facilitate error recovery, but they generally require a higher frequency of insertion in the video sequence, which increases the overall bitrate. CRA frames are not great options for achieving error resilience but provide a better solution than IDR frames in some scenarios.
In summary, IDR frames offer the highest level of random access and error recovery, while CRA frames strike a balance between random access and compression efficiency.
Krishna Rao Vijayanagar
Krishna Rao Vijayanagar, Ph.D., is the Editor-in-Chief of OTTVerse, a news portal covering tech and business news in the OTT industry.
With extensive experience in video encoding, streaming, analytics, monetization, end-to-end streaming, and more, Krishna has held multiple leadership roles in R&D, Engineering, and Product at companies such as Harmonic Inc., MediaMelon, and Airtel Digital. Krishna has published numerous articles and research papers and speaks at industry events to share his insights and perspectives on the fundamentals and the future of OTT streaming.