I'm trying to control sample MPEG2 encoder output GOP structure.
Found that mfxInfoMFX fields GopPicSize, GopRefDist and GopOptFlag are the ones that i need to tune.
But it seems that result is not always what i expect.
For example, I set:
GopPicSize = 15, GopRefDist = 2 and GopOptFlag = MFX_GOP_CLOSED | MFX_GOP_STRICT
and would expect closed GOP of 15 frames fixed size with maximum of2 B-frames in sequence.
Unfortunately what i get is 72% of GOPs having 30 frames, rest either 15 or 16.
Are there any other parameters i need to check in order to get the expected results?
Of course, you are correct about number of B-frames.
That's another anomaly i'm seeing.
The 30 frame GOPs look like this: IPPBBPPBBPPBBPPBBPPBBPPBBPPBBP
while 15 frame ones: IBPBPBPBPBPBPBP.
There are also 16 and 24 frame GOPs present.
All GOPs seem to be closed but their length and structure change.
I'm using example direct show mpeg2 video encoder filter from SDK 126.96.36.19971 with sw library.
As for parameter checking, I belive that CEncVideoFilter::SetParam already does that using MFXVideoENCODE_Query function.
Below is a dump of my mfxVideoParam: