Log in

View Full Version : GOP on or off?


srfscenar
24th November 2004, 16:42
Tell me something please.
When we encode an MPEG2 stream shall we have the GOP (Group Of Pictures) ON or OFF? and if you know how will that effect my picture quality?

Thanx!

dgoodbourn
24th November 2004, 17:16
Check out: w*w.bretl.com/mpeghtml/GOP.HTM

D.

Arky
24th November 2004, 18:11
If you're authoring a Multi-Angle project, then Closed-GOP is compulsory, for a number of technical reasons.

If you're authoring a Partial-Interleave project (AKA 'Seamless-Branching' / 'Seamless Multi-Story') then closed GOPs are optional, but a wise choice.

If you are authoring a conventional project, with no interleaving of any kind, then closed GOPs are entirely optional. One benefit of choosing an Open GOP structure is that the MPEG encoder can potentially use the available bitrate slightly more efficiently, since the last B-frames in each GOP are allowed to reference the I-frame which succeeds them (i.e. the I-frame which begins the next GOP).


Personally, I choose to use closed GOPs all the time, even when I am not interleaving my MPEG streams, since it yields a high-reliability stream and I still get excellent encoding results, despite the marginal reduction in efficiency. For my own purposes, I would only be inclined to use open GOPs if it was necessary to use an extremely low bitrate, to squeeze a large quantity of footage onto one disc. In this unusual instance, I'd need to squeeze the maximum possible efficiency out of my MPEG encoder in order to avoid excessive MPEG artifacts arising from the low bitrate (obviously, in such circumstances, I would still be forced to use Closed GOPs for any Interleave Blocks, if the project involved M-A).


In short, provided you are not authoring a Multi-Angle Title, then you can do as you please, with regard to encoding Open or Closed GOPs, but there are other, more subtle, considerations which may affect your decision, on a case-by-case basis.


Arky ;o)

mpucoder
24th November 2004, 21:05
But if the question is GOP or no GOP, despite what w*w.bretl.com/mpeghtml/GOP.HTM says, GOPs are NOT optional for DVD. They should be structured so that there are no more than 36 displayed fields for NTSC or 30 fields for PAL/SECAM (18 or 15 frames in MPEG-1)

Arky
24th November 2004, 22:20
Heh - good point, mpucoder! I automatically 'interpreted' the question as an 'Open' or 'Closed' GOP question because anything else simply doesn't make sense to me :) - DVD Spec notwithstanding, even if you attempted to create one long GOP, to the entire duration of your MPEG stream, it would still be a Group Of Pictures in, and of, itself, even if they were all I-frames.

All the best,


Arky ;o)

srfscenar
25th November 2004, 08:59
Thanx alot guys for ur answers.
I have another thing...when i encode mpeg2 i "check" an option "DVD Compliant" in my encoder. When that option is enabled, the Closed GOPs option is unavaliable.Is checked and cannot be changed.Which means that if i encode for use on DVDs i cannot "open" gops. The thing is that i have some options for them. For e.g. Intra picture Distance (N) & Reference pictures distance (M). I did some tests and i saw that it effects in scenarist the exact point for chaptering. If for example the numbers are N=12 & M=3 (which is by default) in Scenarist i can add chapters with 12frames accuracy, and if i change the (N) to 3 then i will have 3 frames accuracy.
My question is...if i keep my Intra picture Distance in low numbers, will that effect my quality into better or there will be NO quality effect?

Thanx!

Arky
25th November 2004, 18:35
With respect, srfscenar, this is basic MPEG encoding stuff, which you should find in the manual for the encoder you are using (are you using an old version of Cinemacraft, BTW?).

Nevertheless, in answer to your questions:


Originally posted by srfscenar
...when i encode mpeg2 i "check" an option "DVD Compliant" in my encoder. When that option is enabled, the Closed GOPs option is unavaliable. Is checked and cannot be changed. Which means that if i encode for use on DVDs i cannot "open" gops.




I suspect you are using CCE SP 2.5, but even if you're not, the truth is that you do not need to check the 'DVD Compliant' option (which, in CCE SP 2.5, for example, would force your framesize to 720x576 PAL or 720x480 NTSC). The setting is something MPEG encoder designers generally include as a quick-and-easy way to ensure wide-ranging compatibility of encoded MPEG streams for DVD authoring. It does not mean that all the settings included within that option are always needed in all DVD authoring situations. You can manually set any encoder to produce perfectly compliant streams without using the 'DVD Compliant' checkbox, provided you are familiar with the requirements of the DVD spec, for MPEG parameters (which is why mpucoder and I have given you some important details in this regard. It is important that you also take the time to read the manual, so that you understand what requirements the DVD Spec places upon MPEG encoding. Both your MPEG encoder, AND Scenarist will each provide very useful MPEG structure & compliance information in their .pdf manuals). As I said in my previous post, unless you are encoding streams for an interleaved project, you do not need to use Closed GOPs, since no other section of the DVD spec necessitates this level of consistency between MPEG streams. That is not to say that there are no other reasons under which closed GOPs may be useful, but in terms of the DVD Spec itself, Closed GOPs are only essential for Interleave Blocks.






Originally posted by srfscenar

The thing is that i have some options for them. For e.g. Intra picture Distance (N) & Reference pictures distance (M). I did some tests and i saw that it effects in scenarist the exact point for chaptering. If for example the numbers are N=12 & M=3 (which is by default) in Scenarist i can add chapters with 12frames accuracy, and if i change the (N) to 3 then i will have 3 frames accuracy. My question is...if i keep my Intra picture Distance in low numbers, will that effect my quality into better or there will be NO quality effect?





The reason why it affects how accurately you can place chapter points, within Scenarist (or any other authoring application, for that matter) is that chapter points (PTTs) may only be located at I-frames. The shorter your GOP sequences, the more I-frames you are going to have within a given section of the video stream, and thus the more options you are going to have for chapter point placement.

However, MPEG encoding relies upon P and B frames in order to efficiently compess the data stream (because they use less bitrate than I-frames do. If you want to learn why this is, then you should find plenty of information in your .pdf manuals, or ask as a seperate post). Consequently, any attempt to lessen the number of B and/or P frames, relative to the number of I-frames, will result in less efficient compression, and thus less efficient usage of the limited bitrate budget you have specified in the encoder settings.

This is why we do not encode MPEG streams, for DVD, with just I-frames, although certain other applications (e.g. such as some forms of MPEG for editing purposes) DO use high ratios of I-frames.

For DVD authoring, we are very restricted in how much bitrate we have available, so if we are to stand any chance of getting decent image quality, then we need to ensure that P and B frames are incorporated into our encodes in the most efficient ratios. It's a tradeoff between a number of factors, including image quality, random accessibility, bitrate etc.

As mpucoder remarked, the DVD spec dictates a maximum GOP length limit of 36 fields/18frames (NTSC); 30 fields/15frames (PAL). So, in practical terms, we set MPEG encoders to have a maximum GOP length of 18 for NTSC projects, and 15 for PAL projects. If you exceed these lengths, then you might get a more efficient encode, but you would be violating the DVD spec, so you'd be wasting your time if you intended to use the MPEG streams for DVD authoring purposes. If you need to place a chapter marker at a precise point in an MPEG stream, then it is possible to specify that an I-frame be 'injected' at precisely that point, rather than shortening every single GOP in the entire stream, just to achieve a chapter point at that particular place. Injecting an I-frame in this way means that we can maintain the efficiency of longer GOPs in the rest of the MPEG stream. One of the rare circumstances under which it can be beneficial to shorten GOP lengths is where a very high proportion of the displayed image in your footage is changing rapidly, because, in this situation, B frames cannot reference I and P frames accurately-enough to properly represent the source material. One such example would be where the entire image fades down to, or up from, black (you will notice that many encoders find screen fades very difficult to encode, because, amongst other things, it totally undermines the efficient usage of B-frames).

Most encoders will vary GOP length in order to most-effectively cope with the changing demands of the source footage (they will not increase GOP length, so your MPEG encodes will remain compliant with the DVD Spec, but they will shorten it where necessary). You can see how an encoder has varied GOP length in this way if you buy the Pro version of TecoLTD's Bitrate Viewer (http://www.tecoltd.com/bitratev.htm), which will let you see the structure of each individual GOP in an MPEG stream.


HTH.

Arky ;o)