Browse Source

obs-ffmpeg: Use 2 tile columns in NVENC AV1 for 4K+

When resolution is 4K or higher, use 2 tile columns for NVENC AV1.
Ryan Foster 1 year ago
parent
commit
c25f0592ae
1 changed files with 8 additions and 0 deletions
  1. 8 0
      plugins/obs-ffmpeg/obs-nvenc.c

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

@@ -938,6 +938,14 @@ static bool init_encoder_av1(struct nvenc_data *enc, obs_data_t *settings,
 	if (config->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR)
 		av1_config->enableBitstreamPadding = 1;
 
+#define PIXELCOUNT_4K (3840 * 2160)
+
+	/* If size is 4K+, set tiles to 2 uniform columns. */
+	if ((voi->width * voi->height) >= PIXELCOUNT_4K) {
+		av1_config->enableCustomTileConfig = 0;
+		av1_config->numTileColumns = 2;
+	}
+
 	switch (voi->colorspace) {
 	case VIDEO_CS_601:
 		av1_config->colorPrimaries = 6;