Translation | Alex

Technology review | sasihorfswe

Krishna Rao Vijayanagar wrote this article from OTTVerse.

GOP

Easy Tech #008#

In this article, we will learn about the concepts of closed GOP and open GOP. These two types of GOP are very common in video streaming and affect video compression efficiency, error recovery, and ABR switching capabilities.

What is the GOP?

GOP (A Group of Pictures) refers to A Group of Pictures arranged according to the order of encoding and decoding and display.

Note: If you are not familiar with video compression and frame types, you can start by reading this article: Easy Tech: What are I frames, P Frames and B Frames?

A GOP contains different types of pictures (frames). These basic frame types are:

  • I frames (intra-frame prediction only)

  • P frame (refer to previous frame prediction only)

  • B frame (refer to before and after frame prediction, i.e., bidirectional prediction)

Ok, now that we have these basic frame types, we can build GOP:

  • A GOP usually begins with frame I, followed by a sequence of P and B frames

  • The distance between two consecutive I frames is called the GOP length

  • The distance between successive P frames is known as the mini-GOP size

P frame and B frame are predicted in time domain by referring to other frames. The frames used for prediction can be either I and P frames, or B frames to be referenced. H.264/AVC allows these three types of frames to be combined to form multiple prediction frames.

The question arises — where is the position of the prediction/reference frame when analyzing the Display Order? In other words, can P and B frames refer to several previous GOP frames? It might work for the best, but why not?

To answer these questions, we need to understand the concepts of closed GOP and open GOP. Let’s move on!

What is closed GOP?

As the name implies, closed GOP refers to a GOP that is not open to the public. A frame belonging to a closed GOP can only refer to frames within the same GOP.

In the image above, the first GOP ends with P frame instead of B frame, which means that the encoder will not use the next GOP frame as a reference frame. As a bonus, what do you think would happen if the last GOP frame was B? Isn’t frame B designed to refer back and forth?

In this case, the encoder should ensure that the next reference frame is empty. If the next frame is empty, the B frame is now playing the role of the P frame. However, the encoder always ensures that the last frame is a P frame, which simplifies the process of “closing” the GOP.

Closed GOP is very useful in video streaming and compression. It is an independent segment in a video and clearly separated from other GOP. All problems in closed GOP will not affect other GOP.

Closing the GOP starts with an I frame called the IDR (Instantaneous Decoder Refresh). It is called IDR because when the decoder encounters an IDR frame, it can flush its Decoded Picture Buffer (Decoded Picture Buffer or DPB) since any frame that appeared before the IDR cannot be used as a reference frame for pictures that appear after that IDR. This creates a complete break in the sequence of images.

So, what is the use of IDR and closing GOP?

ABR video streaming: In AN ABR video streaming, the player can switch between different profiles (combining videos at different bit rates and resolutions) based on the bandwidth and how well the decoder buffer is filled. If the player is going to switch from 1080p to 360p, it needs this neat switch. The IDR comes into play at this point, so the player can refresh the buffer and let the 360P video stream in. If you don’t know abRs, read this article: Understanding ABRs and how they work.

Error recovery: If you use HLS when streaming video and each video clip starts with IDR, this means that all frames in the clip cannot refer to frames in the preceding and following clips. So if you lose one clip because of an error, the player can still receive the next clip. Interestingly, Apple’s HLS specification says that IDR should be used every two seconds. (Note: the specification does not say that video clips should last two seconds, but that the GOP size is two seconds).

Trick Mode: As we mentioned earlier, IDR is very useful for fast forward and fast rewind. The player finds the nearest IDR and starts playing the video stream from that point.

Now that you understand closing the GOP, let’s move on to opening the GOP.

What is open GOP?

Open GOP is the opposite of closed GOP, allowing frames in it to reference frames in other GOP. See the second frame I below. The B frame from the previous GOP is used as a reference frame, which means that this is an open GOP (indicated by the yellow arrow).

Open GOP is useful in the following situations:

  • You don’t need to restart a new video for ABR, but you do need to close the GOP

  • You now want to improve the compression efficiency of the video (because B frames can have a higher quality reference frame)

  • When you need to insert i-frames (either to refresh the video quality, or in the case of non-scene transitions, cross-i-frame prediction doesn’t matter)

Total knot

I hope this article helps you understand closed GOP, open GOP and IDR. For more introductory articles on video compression, check out our Easy Tech section. Thanks for reading, see you next time!


Thank you

This article has been translated and published with authorization by author Krishna Rao Vijayanagar. Thank you.

Original link:

Ottverse.com/closed-gop-…

Read more:

Complete guide to video coding

Easy Tech: What are I frame, P frame, and B frame?

Why is video compression so important


The lecturer to recruit

LiveVideoStackCon 2022 Shanghai station, is open to the public recruitment of lecturers, whether you are in the size of the company, title level, old bird or rookie, as long as your content is helpful to technical people, the other is secondary. You are welcome to submit your personal information and topic description via [email protected], and we will give feedback within 24 hours.