Selur's Little Message Board
[HELP] NVEnc Settings - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [HELP] NVEnc Settings (/thread-3435.html)



NVEnc Settings - tomek398 - 13.10.2023

I've been using NVEnc to convert my video files to H.265 format for archiving purposes. 

I try to understand various NVEnc setting available in Hybrid. Here are my questions:

  1. Weighted Prediction

I have found following info:

Quote:Weighted prediction is not supported if the encode session is configured with B frames.

Weighted prediction is not supported if DirectX 12 device is used.

https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/nvenc-video-encoder-api-prog-guide/index.html

I don't understand what means that "session is configured with B frames" if the context of Hybrid settings (my setting are attached)
I've noticed that I can select  /P-frame Settings/Weighted P-frames even is some setting for B-frames are also active. Does it mean that, when I use Weighted Prediction then B-frames are not enabled?

I also don't understand second statement about Direct X 12


  1. 2. I don't know if or when I should use B-frame ref mode: each/middle

Any help here would be welcomed.


RE: NVEnc Settings - Selur - 14.10.2023

The api can be accessed through different interfaces, since NVEncC does not use the DirectX interface can be ignored.
Regarding the weighted prediction of P-frames: I checked when B-frames are enabled, NVEncC will output:
weighted prediction with B frames unsupported.
So I'll adjust the gui to disable that option if b-frames are enabled. (I would recommend to use b-frames over weighted p-frames)

Cu Selur


RE: NVEnc Settings - tomek398 - 14.10.2023

Thanks you for that explanation

Could you please also explain me that are recommendations regarding:  B-frame ref mode: each/middle

Which option: each or middle is recommended? I couldn't find good explanation on internet.


RE: NVEnc Settings - Selur - 14.10.2023

Quote:--bref-mode <string>
Specify B frame reference mode.
  • auto (default)
  • disabled
  • each ... use each B frames as references
  • middle ... only (Number of B-frame)/2 th B-frame will be used for reference
source: https://github.com/rigaya/NVEnc/blob/master/NVEncC_Options.en.md#--bref-mode-string
(atm. Hybrid does not have 'auto' as an option)

From the api, one can see what 'auto' would do:
Quote:B-Frames As Reference

Using B frame as a reference improves subjective and objective encoded quality with no performance impact. Hence the users enabling multiple B frames are strongly recommended to enable this feature.

To use the feature, follow these steps:
  • Query availability of the feature using NvEncGetEncodeCaps API and checking for NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE in the return value.
  • During encoder initialization, set NV_ENC_CONFIG_H264/NV_ENC_CONFIG_HEVC/NV_ENC_CONFIG_AV1::useBFramesAsRef = NV_ENC_BFRAME_REF_MODE_MIDDLE:
    • For H.264 and HEVC, this will set the (N/2)th B frame as reference, where N = number of B frames. In case N is odd, then (N-1)/2th frame will be picked up as reference.
    • For AV1, this will set every other B frame as an Altref2 reference but for the last B frame in the Altref interval.
source: https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/nvenc-video-encoder-api-prog-guide/index.html#b-frames-as-reference

So for H.264 and HEVC NVIDA by default would use 'middle' and for AV1 they would use 'each'.
Personally, I use 'each' for both, but that's not really based on any tests, but on sheer lazyness. Smile

Cu Selur