From 01f19ae9d2d490e5a03eefc05060aaf6186d9a37 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 23 Jul 2024 15:07:49 +0200 Subject: Rename argument -mf to -df (keep -mf for backwards compatibility) --- README.md | 2 +- TODO | 2 ++ extra/gpu-screen-recorder.service | 2 +- src/main.cpp | 21 ++++++++++++--------- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ab1e53f..9b0cbb1 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ You can see a list of monitor names to record if you use an invalid monitor name Streaming works the same as recording, but the `-o` argument should be path to the live streaming service you want to use (including your live streaming key). Take a look at `scripts/twitch-stream.sh` to see an example of how to stream to twitch. ## Replay mode Run `gpu-screen-recorder` with the `-c mp4` and `-r` option, for example: `gpu-screen-recorder -w screen -f 60 -r 30 -c mp4 -o ~/Videos`. Note that in this case, `-o` should point to a directory.\ -If `-mf yes` is set, replays are save in folders based on the date. +If `-df yes` is set, replays are save in folders based on the date. The file path to the saved replay is output to stdout. All other output from GPU Screen Recorder are output to stderr. You can also use the `-sc` option to specify a script that should be run (asynchronously) when the video has been saved and the script will have access to the location of the saved file as its first argument. This can be used for example to show a notification when a replay has been saved, to rename the video with a title that matches the game played (see `scripts/record-save-application-name.sh` as an example on how to do this on X11) or to re-encode the video.\ diff --git a/TODO b/TODO index f6b69cf..ff2f917 100644 --- a/TODO +++ b/TODO @@ -159,3 +159,5 @@ Move most kms data to kms client. We dont need root access for everything that i Show rotated window size in monitor list when using incorrect monitor name. Desktop portal capture on kde plasma makes notifications not show up unless the notification is set as urgent. How to fix this? do we have to make our own notification system? + +Add the option to specify a path to desktop portal session token, to allow different recording modes (streaming, recording, replay) to restore with different setup. \ No newline at end of file diff --git a/extra/gpu-screen-recorder.service b/extra/gpu-screen-recorder.service index d4d9f3b..aa1d702 100644 --- a/extra/gpu-screen-recorder.service +++ b/extra/gpu-screen-recorder.service @@ -18,7 +18,7 @@ Environment=COLOR_RANGE=limited Environment=KEYINT=2 Environment=ENCODER=gpu Environment=RESTORE_PORTAL_SESSION=yes -ExecStart=/bin/sh -c 'AUDIO="${AUDIO_DEVICE:-$(pactl get-default-sink).monitor}"; gpu-screen-recorder -v no -w "$WINDOW" -c "$CONTAINER" -q "$QUALITY" -k "$CODEC" -ac "$AUDIO_CODEC" -a "$AUDIO" -a "$SECONDARY_AUDIO_DEVICE" -f "$FRAMERATE" -r "$REPLAYDURATION" -o "$OUTPUTDIR" -mf "$MAKEFOLDERS" $ADDITIONAL_ARGS -cr "$COLOR_RANGE" -keyint "$KEYINT" -restore-portal-session "$RESTORE_PORTAL_SESSION" -encoder "$ENCODER"' +ExecStart=/bin/sh -c 'AUDIO="${AUDIO_DEVICE:-$(pactl get-default-sink).monitor}"; gpu-screen-recorder -v no -w "$WINDOW" -c "$CONTAINER" -q "$QUALITY" -k "$CODEC" -ac "$AUDIO_CODEC" -a "$AUDIO" -a "$SECONDARY_AUDIO_DEVICE" -f "$FRAMERATE" -r "$REPLAYDURATION" -o "$OUTPUTDIR" -df "$MAKEFOLDERS" $ADDITIONAL_ARGS -cr "$COLOR_RANGE" -keyint "$KEYINT" -restore-portal-session "$RESTORE_PORTAL_SESSION" -encoder "$ENCODER"' KillSignal=SIGINT Restart=on-failure RestartSec=5s diff --git a/src/main.cpp b/src/main.cpp index 143e251..c6f341f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1003,7 +1003,7 @@ static void open_video_hardware(AVCodecContext *codec_context, VideoQuality vide static void usage_header() { const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder"; - fprintf(stderr, "usage: %s -w [-c ] [-s WxH] -f [-a ] [-q ] [-r ] [-k h264|hevc|hevc_hdr|av1|av1_hdr|vp8|vp9] [-ac aac|opus|flac] [-ab ] [-oc yes|no] [-fm cfr|vfr|content] [-cr limited|full] [-mf yes|no] [-sc ] [-cursor yes|no] [-keyint ] [-restore-portal-session yes|no] [-encoder gpu|cpu] [-o ] [-v yes|no] [-h|--help]\n", program_name); + fprintf(stderr, "usage: %s -w [-c ] [-s WxH] -f [-a ] [-q ] [-r ] [-k h264|hevc|hevc_hdr|av1|av1_hdr|vp8|vp9] [-ac aac|opus|flac] [-ab ] [-oc yes|no] [-fm cfr|vfr|content] [-cr limited|full] [-df yes|no] [-sc ] [-cursor yes|no] [-keyint ] [-restore-portal-session yes|no] [-encoder gpu|cpu] [-o ] [-v yes|no] [-h|--help]\n", program_name); } // TODO: Update with portal info @@ -1068,7 +1068,7 @@ static void usage_full() { fprintf(stderr, " Limited color range means that colors are in range 16-235 (4112-60395 for hdr) while full color range means that colors are in range 0-255 (0-65535 for hdr).\n"); fprintf(stderr, " Note that some buggy video players (such as vlc) are unable to correctly display videos in full color range.\n"); fprintf(stderr, "\n"); - fprintf(stderr, " -mf Organise replays in folders based on the current date.\n"); + fprintf(stderr, " -df Organise replays in folders based on the current date.\n"); fprintf(stderr, "\n"); fprintf(stderr, " -sc Run a script on the saved video file (asynchronously). The first argument to the script is the filepath to the saved video file and the second argument is the recording type (either \"regular\" or \"replay\").\n"); fprintf(stderr, " Not applicable for live streams.\n"); @@ -2000,6 +2000,7 @@ int main(int argc, char **argv) { { "-pixfmt", Arg { {}, true, false } }, { "-v", Arg { {}, true, false } }, { "-mf", Arg { {}, true, false } }, + { "-df", Arg { {}, true, false } }, { "-sc", Arg { {}, true, false } }, { "-cr", Arg { {}, true, false } }, { "-cursor", Arg { {}, true, false } }, @@ -2160,16 +2161,18 @@ int main(int argc, char **argv) { } bool make_folders = false; - const char *make_folders_str = args["-mf"].value(); - if(!make_folders_str) - make_folders_str = "no"; + const char *date_folders_str = args["-df"].value(); + if(!date_folders_str) + date_folders_str = args["-mf"].value(); + if(!date_folders_str) + date_folders_str = "no"; - if(strcmp(make_folders_str, "yes") == 0) { + if(strcmp(date_folders_str, "yes") == 0) { make_folders = true; - } else if(strcmp(make_folders_str, "no") == 0) { + } else if(strcmp(date_folders_str, "no") == 0) { make_folders = false; } else { - fprintf(stderr, "Error: -mf should either be either 'yes' or 'no', got: '%s'\n", make_folders_str); + fprintf(stderr, "Error: -df should either be either 'yes' or 'no', got: '%s'\n", date_folders_str); usage(); } @@ -2183,7 +2186,7 @@ int main(int argc, char **argv) { } else if(strcmp(restore_portal_session_str, "no") == 0) { restore_portal_session = false; } else { - fprintf(stderr, "Error: -restore-portal-session should either be either 'yes' or 'no', got: '%s'\n", make_folders_str); + fprintf(stderr, "Error: -restore-portal-session should either be either 'yes' or 'no', got: '%s'\n", restore_portal_session_str); usage(); } -- cgit v1.2.3