obs-studio/patches/0007-5fdda179ed2768304a98d48f4074e54fe7cbf5b3.patch

28 lines
1.1 KiB
Diff
Raw Normal View History

2023-09-29 17:20:04 +02:00
From 5fdda179ed2768304a98d48f4074e54fe7cbf5b3 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Fri, 30 Jun 2023 07:23:41 +0200
Subject: [PATCH] obs-ffmpeg: Increase initial buffer fullness for VAAPI
Default ffmpeg initial buffer fullness (75%) is too low
and results in significantly lower video quality on AMD cards.
Changing it to 100% fixes the quality and also matches what
AMF encoder is doing.
---
plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index c5aa0128a54b9..1a6ecd63ae4d4 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -300,6 +300,8 @@ static bool vaapi_update(void *data, obs_data_t *settings, bool hevc)
enc->context->level = level;
enc->context->bit_rate = bitrate * 1000;
enc->context->rc_max_rate = maxrate * 1000;
+ enc->context->rc_initial_buffer_occupancy =
+ (maxrate ? maxrate : bitrate) * 1000;
enc->context->width = obs_encoder_get_width(enc->encoder);
enc->context->height = obs_encoder_get_height(enc->encoder);