英伟达
直播中

李高胜

7年用户 204经验值
私信 关注
[问答]

怎么在游戏运行时改变比特率

我正在尝试在游戏运行时更改比特率。
这样做的正确方法是什么?
设置`dwNewAvgBitrate = newlowerrate`并传递给`NvIFRTransferRenderTargetToH264HWEncoder`没有做任何事情。

以上来自于谷歌翻译


以下为原文

I am trying to change the bitrate while game is running. What is the right way to do that? Setting `dwNewAvgBitrate = newlowerrate` and passing to `NvIFRTransferRenderTargetToH264HWEncoder` is not doing anything.

回帖(4)

杨芳

2018-9-14 10:47:27
我也有兴趣进行动态比特率调整,而不必销毁/实例化一个全新的编码器。
这可能使用GRID SDK吗?

以上来自于谷歌翻译


以下为原文

I am also interested in doing a dynamic bitrate adjustment without having to destroy/instantiate a whole new encoder. Is this possible using the GRID SDK?
举报

李晓龙

2018-9-14 10:54:45
是的,NVENC可以支持更改动态比特率,分辨率,也支持,这也反映在GRID API调用中。
如果只是更改比特率,请确保您还要设置参数。
NV_IFROGL_HW_ENC_PARAMS参数
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE;
params.newAvgBitrate =(你新的平均比特率)
params.newVBVInitialDelay =(你的新VBV初始延迟)
params.newVBVBufferSize =(你的新VBV缓冲区大小)
如果您只想更改分辨率。
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE;
params.newWidth =(新的编码器宽度)
params.newHeight =(新的编码器高度)
如果要更改分辨率和比特率,则必须同时设置标志)。
params.flags =(NV_IFROGL_HW_ENC_PARAM_FLAGS)(NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE | NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE);
然后更改两个参数。

以上来自于谷歌翻译


以下为原文

Yes the NVENC can support changing dynamic bitrate, resolution, is supported, and that is also reflected in the GRID API call as well.  

If just changing the bitrate, make sure that you are also setting parameters.

NV_IFROGL_HW_ENC_PARAMS params
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE;
params.newAvgBitrate      = (your new Avg bitrate)
params.newVBVInitialDelay = (your new VBV Initial Delay)
params.newVBVBufferSize   = (your new VBV Buffer Size)

If you just want to change the resolution.
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE;
params.newWidth  = (new encoder width)
params.newHeight = (new encoder height)

If you want to change both resolution and bitrate, the flags must be both set).
params.flags = (NV_IFROGL_HW_ENC_PARAM_FLAGS)(NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE | NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE);

Then change both parameters.
举报

蔡婷

2018-9-14 11:12:07
NV_IFROGL_HW_ENC_PARAMS是NvIFR结构。
我们主要使用NvFBC进行编码。
NvFBC和NvIFR是否可以互换以设置参数,或者我们需要设置NvFBC的等效params结构吗?

以上来自于谷歌翻译


以下为原文

NV_IFROGL_HW_ENC_PARAMS is an NvIFR struct. We’re primarily using NvFBC for our encoding. Are NvFBC and NvIFR interchangeable for setting up parameters or is there an equivalent params struct for NvFBC that we need to set?
举报

刘旭阳

2018-9-14 11:17:34
通过默认设置.dwFlags = NVFBC_TOH264_NOFLAGS,编码器将等待屏幕上的更改以完成编码器api调用。
直到那时线程处于等待状态。
除了触发更改或终止调用进程之外,有没有办法退出此等待状态?

以上来自于谷歌翻译


以下为原文

by setting .dwFlags = NVFBC_TOH264_NOFLAGS by default the encoder will wait for a change on the screen to finish the encoder api call. until then the thread is in a wait state.

is there a way to exit this wait state other than triggering a change or terminating the calling process?
举报

更多回帖

发帖
×
20
完善资料,
赚取积分