How to enable B-Frames

Hi!

In the programming guide at the end there is “Recommended NVENC settings for various use-cases” (Table 1). For some configurations B frames are recommended, but I see no setting where to enable/disable B frames. Where can I do this?

Jochen

Hi Jochen,

You can enable B frames by NV_ENC_CONFIG:: frameIntervalP. The explanation of this variable is provided in the comment of nvencodeapi.h.

If you are using B frames, please also consider enabling other features like LookAhead, B-as-ref etc. which further improves the quality on top of normal B frame feature. These are documented in the programming guide.

As a general suggestion, we would also encourage you to look at the nvencodeapi.h along with the programming guide. The encode API header also provides good amount of information/documentation as how to use to API.

Thanks,
Ryan Park

Hi Ryan,

Thanks for the info. In the code I see frameIntervalP = 0: I, 1: IPP, 2: IBP, 3: IBBP.
Is it also possible to have for example IBBBBBP by setting frameIntervalP to 6?

Is it required that gopLength is a multiple of the frame interval length? Does it simply repeat the GOP pattern? Does for example frameIntervalP = 1 and gopLength = 9 result in IPPIPPIPP or is it IPPPPPPPP ? And does frameIntervalP = 3 and gopLength = 16 result in IBBPIBBPIBBPIBBP or is it IBBPBBPBBPBBPBBP ?
Other possibility would be representing frameIntervalP as regular expression:

is it

frameIntervalP = 0: I+, 1: (IP)+, 2: (IBP)+, 3: (IBBP)+

or (more likely)

frameIntervalP = 0: I+, 1: IP+, 2: I(BP)+, 3: I(BBP)+

?

Jochen

Is it also possible to have for example IBBBBBP by setting frameIntervalP to 6?

Yes. That’s right. The number of B frames is frameIntervalP-1.

Is it required that gopLength is a multiple of the frame interval length?

No. The GOP length means the interval between 2 Intra frames. Say if gopLength = 30 and frameIntervalP =3 then the pattern will look like IBBPBBPBBP….And one I frame will be introduced after 30 frames and so on. As explained in the encodeapi header frameIntervalP is the GOP pattern and is not related with GOP length.

Let us know if you have further questions.

Thanks,
Ryan Park