[Libav-user] Closed GOP structure problem

Camera Man i.like.privacy.too at gmail.com
Thu Jan 1 06:46:04 CET 2015

On 12/19/2014 05:08 PM, Valentin Noël wrote:
 > Hi to all,
 > I would like to encode MPEG-2 video with closed GOP of 12 frames, and 
a structure like IBBPBBPBBPBB.
 > However, the result is a GOP of 10 frames IBBPBBPBBP, with two 
missing B frames.

The meaning of "closed GOP" is that it can be decoded on its own without 
help from other GOPs.

a B frame is between two non-B frames, e.g. your first B is between your 
first I and your first P, the 3rd B is between the first P and the second P.

Now, if you had a B at the end, which two frames would it be between? 
There is no I or P frame that follows it. So in a closed GOP the last 
frame cannot be a B frame.

Also, it is important to remember that the presentation and decoding 
order are different. e.g. the presentation is what you wrote:


But the decoding must (because B needs both previous I/P and next I/P) be:


More information about the Libav-user mailing list