Ver código fonte

obs-ffmpeg: Add `disable_scenecut` option for NVENC

This is functionally the same as x264's `scenecut=0` option
Ruwen Hahn 2 anos atrás
pai
commit
8fb32c37ee

+ 4 - 0
plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c

@@ -109,6 +109,7 @@ static bool nvenc_update(struct nvenc_encoder *enc, obs_data_t *settings,
 	int gpu = (int)obs_data_get_int(settings, "gpu");
 	bool cbr_override = obs_data_get_bool(settings, "cbr");
 	int bf = (int)obs_data_get_int(settings, "bf");
+	bool disable_scenecut = obs_data_get_bool(settings, "disable_scenecut");
 
 	video_t *video = obs_encoder_video(enc->ffve.encoder);
 	const struct video_output_info *voi = video_output_get_info(video);
@@ -170,6 +171,9 @@ static bool nvenc_update(struct nvenc_encoder *enc, obs_data_t *settings,
 	av_opt_set(enc->ffve.context->priv_data, "level", "auto", 0);
 	av_opt_set_int(enc->ffve.context->priv_data, "gpu", gpu, 0);
 
+	av_opt_set_int(enc->ffve.context->priv_data, "no-scenecut",
+		       disable_scenecut, 0);
+
 	// This is ugly but ffmpeg wipes priv_data on error and we need
 	// to know this to show a proper error message.
 	enc->gpu = gpu;

+ 3 - 0
plugins/obs-ffmpeg/obs-nvenc.c

@@ -456,6 +456,7 @@ static bool init_encoder_base(struct nvenc_data *enc, obs_data_t *settings,
 	bool vbr = astrcmpi(rc, "VBR") == 0;
 	bool psycho_aq = !compatibility &&
 			 obs_data_get_bool(settings, "psycho_aq");
+	bool disable_scenecut = obs_data_get_bool(settings, "disable_scenecut");
 	NVENCSTATUS err;
 
 	video_t *video = obs_encoder_video(enc->encoder);
@@ -638,6 +639,8 @@ static bool init_encoder_base(struct nvenc_data *enc, obs_data_t *settings,
 		}
 	}
 
+	enc->config.rcParams.disableIadapt = disable_scenecut;
+
 	/* psycho aq */
 	if (!compatibility) {
 		if (nv_get_cap(enc, NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ)) {