From 2f60f4c109f1bcc748d5f0d937476e8708a4073b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 22 Nov 2023 17:31:18 +0100 Subject: [PATCH] h264 vaapi quality 5 --- install.sh | 2 ++ src/egl.c | 6 +++--- src/main.cpp | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index c82ad44..0d413ee 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,9 @@ install -Dm755 "gpu-screen-recorder" "/usr/bin/gpu-screen-recorder" if [ -d "/usr/lib/systemd/user" ]; then install -Dm644 "extra/gpu-screen-recorder.service" "/usr/lib/systemd/user/gpu-screen-recorder.service" fi +# Not necessary, but removes the password prompt when trying to record a monitor on amd/intel or nvidia wayland setcap cap_sys_admin+ep /usr/bin/gsr-kms-server +# Not ncessary, but allows use of EGL_CONTEXT_PRIORITY_LEVEL_IMG which might decrease performance impact on the system setcap cap_sys_nice+ep /usr/bin/gpu-screen-recorder echo "Successfully installed gpu-screen-recorder" diff --git a/src/egl.c b/src/egl.c index e1d44e7..faae6e7 100644 --- a/src/egl.c +++ b/src/egl.c @@ -227,13 +227,13 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) { const int32_t attr[] = { EGL_BUFFER_SIZE, 24, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, - EGL_NONE, EGL_NONE + EGL_NONE }; const int32_t ctxattr[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, /* requires cap_sys_nice, ignored otherwise */ - EGL_NONE, EGL_NONE + EGL_NONE }; if(wayland) { @@ -249,7 +249,7 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) { // Fetch globals wl_display_roundtrip(self->wayland.dpy); - // fetch wl_output + // Fetch wl_output wl_display_roundtrip(self->wayland.dpy); if(!self->wayland.compositor) { diff --git a/src/main.cpp b/src/main.cpp index 797c290..6ab0ef1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -417,6 +417,8 @@ static AVCodecContext *create_video_codec_context(AVPixelFormat pix_fmt, //codec_context->rc_max_rate = codec_context->bit_rate; //codec_context->rc_min_rate = codec_context->bit_rate; //codec_context->rc_buffer_size = codec_context->bit_rate / 10; + // TODO: Do this when not using cqp + //codec_context->rc_initial_buffer_occupancy = codec_context->bit_rate * 1000; codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; @@ -735,7 +737,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality if(codec_context->codec_id == AV_CODEC_ID_H264) { av_dict_set(&options, "profile", "high", 0); - av_dict_set_int(&options, "quality", 7, 0); + av_dict_set_int(&options, "quality", 5, 0); // quality preset } else if(codec_context->codec_id == AV_CODEC_ID_AV1) { av_dict_set(&options, "profile", "main", 0); // TODO: use professional instead? av_dict_set(&options, "tier", "main", 0);