Procházet zdrojové kódy

obs-ffmpeg: Fix constant QP mode in new NVENC

derrod před 7 roky
rodič
revize
18c59c3e54
1 změnil soubory, kde provedl 6 přidání a 11 odebrání
  1. 6 11
      plugins/obs-ffmpeg/jim-nvenc.c

+ 6 - 11
plugins/obs-ffmpeg/jim-nvenc.c

@@ -445,19 +445,14 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
 		? NV_ENC_PARAMS_RC_VBR_HQ
 		: NV_ENC_PARAMS_RC_VBR;
 
-	if (astrcmpi(rc, "cqp") == 0) {
-		config->rcParams.targetQuality = cqp;
-		config->rcParams.averageBitRate = 0;
-		config->rcParams.maxBitRate = 0;
-		enc->can_change_bitrate = false;
+	if (astrcmpi(rc, "cqp") == 0 || astrcmpi(rc, "lossless") == 0) {
+		if (astrcmpi(rc, "lossless") == 0)
+			cqp = 0;
 
-	} else if (astrcmpi(rc, "lossless") == 0) {
 		config->rcParams.rateControlMode = NV_ENC_PARAMS_RC_CONSTQP;
-		config->rcParams.constQP.qpInterP = 0;
-		config->rcParams.constQP.qpInterB = 0;
-		config->rcParams.constQP.qpIntra = 0;
-		config->rcParams.averageBitRate = 0;
-		config->rcParams.maxBitRate = 0;
+		config->rcParams.constQP.qpInterP = cqp;
+		config->rcParams.constQP.qpInterB = cqp;
+		config->rcParams.constQP.qpIntra = cqp;
 		enc->can_change_bitrate = false;
 
 	} else if (astrcmpi(rc, "vbr") != 0) { /* CBR by default */