From 6bed94f9296fe120c7ed56ce543957524d011e3d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 31 Dec 2023 16:01:09 +0100 Subject: More useful error message, fix setcap on opensuse, prepare for tray --- README.md | 7 ++----- com.dec05eba.gpu_screen_recorder.appdata.xml | 5 +++++ .../32x32/apps/com.dec05eba.gpu_screen_recorder.png | Bin 0 -> 2202 bytes .../com.dec05eba.gpu_screen_recorder.tray_idle.png | Bin 0 -> 2265 bytes ...com.dec05eba.gpu_screen_recorder.tray_recording.png | Bin 0 -> 2262 bytes .../com.dec05eba.gpu_screen_recorder.tray_idle.png | Bin 0 -> 2080 bytes ...com.dec05eba.gpu_screen_recorder.tray_recording.png | Bin 0 -> 2077 bytes src/main.cpp | 17 ++++++++++++----- 8 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png create mode 100644 icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png create mode 100644 icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png create mode 100644 icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png create mode 100644 icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png diff --git a/README.md b/README.md index a47d8f3..1429ee8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ gtk frontend for [gpu-screen-recorder](https://git.dec05eba.com/gpu-screen-recorder/about/). -This is a screen recorder that has minimal impact on system performance by recording a window using the GPU only, +This is a screen recorder that has minimal impact on system performance by recording your monitor using the GPU only, similar to shadowplay on windows. This is the fastest screen recording tool for Linux. This screen recorder can be used for recording your desktop offline, for live streaming and for nvidia shadowplay-like instant replay, @@ -23,12 +23,9 @@ For you as a user this only means that if you installed GPU Screen Recorder as a On a system with a i5 4690k CPU and a GTX 1080 GPU:\ When recording Legend of Zelda Breath of the Wild at 4k, fps drops from 30 to 7 when using OBS Studio + nvenc, however when using this screen recorder the fps remains at 30.\ When recording GTA V at 4k on highest settings, fps drops from 60 to 23 when using obs-nvfbc + nvenc, however when using this screen recorder the fps only drops to 58. The quality is also much better when using gpu-screen-recorder.\ -It is recommended to save the video to a SSD because of the large file size, which a slow HDD might not be fast enough to handle.\ -Note that if you have a very powerful CPU and a not so powerful GPU and play a game that is bottlenecked by your GPU and barely uses your CPU then a CPU based screen recording (such as OBS with libx264 instead of nvenc) might perform slightly better than GPU Screen Recorder. At least on NVIDIA. +It is recommended to save the video to a SSD because of the large file size, which a slow HDD might not be fast enough to handle. ## Note about optimal performance on NVIDIA NVIDIA driver has a "feature" (read: bug) where it will downclock memory transfer rate when a program uses cuda (or nvenc, which uses cuda), such as GPU Screen Recorder. See https://git.dec05eba.com/gpu-screen-recorder/about/ for more information and how to overcome this. -## Note about optimal performance on AMD/Intel -Performance is the same when recording a single window or the monitor, however in some cases, such as when gpu usage is 100%, the video capture rate might be slower than the games fps when recording a single window instead of a monitor. Recording the monitor instead is recommended in such cases. ## Installation This program depends on [gpu-screen-recorder](https://git.dec05eba.com/gpu-screen-recorder/) which needs to be installed first.\ diff --git a/com.dec05eba.gpu_screen_recorder.appdata.xml b/com.dec05eba.gpu_screen_recorder.appdata.xml index 2f94681..055fb08 100644 --- a/com.dec05eba.gpu_screen_recorder.appdata.xml +++ b/com.dec05eba.gpu_screen_recorder.appdata.xml @@ -53,6 +53,11 @@ + + +

Fix monitor capture on AMD/Intel or NVIDIA Wayland on some distros, such as OpenSUSE

+
+
    diff --git a/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png new file mode 100644 index 0000000..431162b Binary files /dev/null and b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png differ diff --git a/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png new file mode 100644 index 0000000..852a936 Binary files /dev/null and b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png differ diff --git a/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png new file mode 100644 index 0000000..f25392b Binary files /dev/null and b/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png differ diff --git a/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png b/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png new file mode 100644 index 0000000..0097b4c Binary files /dev/null and b/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_idle.png differ diff --git a/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png b/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png new file mode 100644 index 0000000..a5c6fa0 Binary files /dev/null and b/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.tray_recording.png differ diff --git a/src/main.cpp b/src/main.cpp index 09157a4..da7861c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2057,6 +2057,13 @@ static bool get_supported_video_codecs(SupportedVideoCodecs *supported_video_cod static gboolean on_remove_password_prompts_button_click(GtkButton*, gpointer) { int result = system("flatpak-spawn --host pkexec setcap cap_sys_admin+ep /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server"); + if(result != 0) { + // This can happen on some distros such as OpenSUSE because setcap is not found by which by the user + // and neither pkexec, and only by the root user directly. In such cases we guess the path to setcap. + int result2 = system("flatpak-spawn --host pkexec /usr/sbin/setcap cap_sys_admin+ep /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server"); + if(result2 == 0) + result = 0; + } switch(result) { case 0: { gtk_widget_set_sensitive(GTK_WIDGET(remove_password_prompts_button), false); @@ -2073,7 +2080,7 @@ static gboolean on_remove_password_prompts_button_click(GtkButton*, gpointer) { } default: { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to remove password prompts (/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server may not exist or it may be read-only)"); + "Unable to remove password prompts (/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server may not exist or it may be read-only or setcap is not installed on your system)"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); break; @@ -2874,15 +2881,15 @@ static void load_config(const gpu_info &gpu_inf) { if(!supported_video_codecs.h264 && !supported_video_codecs.hevc && gpu_inf.vendor != GPU_VENDOR_NVIDIA && config.main_config.codec != "av1") { if(supported_video_codecs.av1) { - GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Your distro has disabled support for H264 and HEVC video codecs in video encoding. Switched video codec to AV1. If you wish to use H264/HEVC video codecs then switch to a less user hostile distro."); + GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "Your distro has disabled support for H264 and HEVC video codecs. Switched video codec to AV1. If you wish to use H264/HEVC video codecs then follow your distros guide to install a non-crippled mesa (with H264 and HEVC support) or switch to a less user hostile distro or recompile mesa from source. For example on fedora you may need to follow this: Hardware Accelerated Codec."); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); config.main_config.codec = "av1"; gtk_combo_box_set_active_id(GTK_COMBO_BOX(video_codec_input_menu), config.main_config.codec.c_str()); } else { - GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Either your GPU doesn't support H264/HEVC video codecs in video encoding or your distro has disabled support for those video codecs. Switch to a less user hostile distro."); + GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "Either your GPU doesn't support H264/HEVC video codecs or your distro has disabled support for those video codecs. If you wish to use H264/HEVC video codecs then follow your distros guide to install a non-crippled mesa (with H264 and HEVC support) or switch to a less user hostile distro or recompile mesa from source, if you know that your GPU supports H264/HEVC. For example on fedora you may need to follow this: Hardware Accelerated Codec."); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); g_application_quit(G_APPLICATION(select_window_userdata.app)); -- cgit v1.2.3