|
|
@@ -228,6 +228,23 @@ static bool nvenc_update(void *data, obs_data_t *settings)
|
|
|
return nvenc_init_codec(enc);
|
|
|
}
|
|
|
|
|
|
+static bool nvenc_reconfigure(void *data, obs_data_t *settings)
|
|
|
+{
|
|
|
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 19, 101)
|
|
|
+ struct nvenc_encoder *enc = data;
|
|
|
+
|
|
|
+ int bitrate = (int)obs_data_get_int(settings, "bitrate");
|
|
|
+ const char *rc = obs_data_get_string(settings, "rate_control");
|
|
|
+ bool cbr = astrcmpi(rc, "CBR") == 0;
|
|
|
+ bool vbr = astrcmpi(rc, "VBR") == 0;
|
|
|
+ if (cbr || vbr) {
|
|
|
+ enc->context->bit_rate = bitrate * 1000;
|
|
|
+ enc->context->rc_max_rate = bitrate * 1000;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
static void nvenc_destroy(void *data)
|
|
|
{
|
|
|
struct nvenc_encoder *enc = data;
|
|
|
@@ -547,6 +564,7 @@ struct obs_encoder_info nvenc_encoder_info = {
|
|
|
.create = nvenc_create,
|
|
|
.destroy = nvenc_destroy,
|
|
|
.encode = nvenc_encode,
|
|
|
+ .update = nvenc_reconfigure,
|
|
|
.get_defaults = nvenc_defaults,
|
|
|
.get_properties = nvenc_properties_ffmpeg,
|
|
|
.get_extra_data = nvenc_extra_data,
|