h264 vaapi quality 5

This commit is contained in:
dec05eba 2023-11-22 17:31:18 +01:00
parent 6ace5405e4
commit 2f60f4c109
3 changed files with 8 additions and 4 deletions

View File

@ -14,7 +14,9 @@ install -Dm755 "gpu-screen-recorder" "/usr/bin/gpu-screen-recorder"
if [ -d "/usr/lib/systemd/user" ]; then if [ -d "/usr/lib/systemd/user" ]; then
install -Dm644 "extra/gpu-screen-recorder.service" "/usr/lib/systemd/user/gpu-screen-recorder.service" install -Dm644 "extra/gpu-screen-recorder.service" "/usr/lib/systemd/user/gpu-screen-recorder.service"
fi 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 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 setcap cap_sys_nice+ep /usr/bin/gpu-screen-recorder
echo "Successfully installed gpu-screen-recorder" echo "Successfully installed gpu-screen-recorder"

View File

@ -227,13 +227,13 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) {
const int32_t attr[] = { const int32_t attr[] = {
EGL_BUFFER_SIZE, 24, EGL_BUFFER_SIZE, 24,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE, EGL_NONE EGL_NONE
}; };
const int32_t ctxattr[] = { const int32_t ctxattr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2, EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, /* requires cap_sys_nice, ignored otherwise */ EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, /* requires cap_sys_nice, ignored otherwise */
EGL_NONE, EGL_NONE EGL_NONE
}; };
if(wayland) { if(wayland) {
@ -249,7 +249,7 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) {
// Fetch globals // Fetch globals
wl_display_roundtrip(self->wayland.dpy); wl_display_roundtrip(self->wayland.dpy);
// fetch wl_output // Fetch wl_output
wl_display_roundtrip(self->wayland.dpy); wl_display_roundtrip(self->wayland.dpy);
if(!self->wayland.compositor) { if(!self->wayland.compositor) {

View File

@ -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_max_rate = codec_context->bit_rate;
//codec_context->rc_min_rate = codec_context->bit_rate; //codec_context->rc_min_rate = codec_context->bit_rate;
//codec_context->rc_buffer_size = codec_context->bit_rate / 10; //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; 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) { if(codec_context->codec_id == AV_CODEC_ID_H264) {
av_dict_set(&options, "profile", "high", 0); 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) { } 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, "profile", "main", 0); // TODO: use professional instead?
av_dict_set(&options, "tier", "main", 0); av_dict_set(&options, "tier", "main", 0);