diff options
| author | dec05eba <dec05eba@protonmail.com> | 2026-08-02 02:03:21 +0200 |
|---|---|---|
| committer | dec05eba <dec05eba@protonmail.com> | 2026-08-02 20:05:13 +0200 |
| commit | 8fc8aaa7993d071955cb56dfda70555d953da916 (patch) | |
| tree | 873855cd1b469a82d6b87c45533a86bb96768f8d | |
| parent | f547fcc354671c672fffb20092e72d231e6ed1e4 (diff) | |
Document the ipc option next to the signals in the readme
The remote control section is now split into a signals part and an ipc
part with gsr-cli examples, and it points at the gsr-cli man page and the
IPC section of the gpu-screen-recorder man page.
| -rw-r--r-- | README.md | 29 | ||||
| -rw-r--r-- | src/recorder/recorder.c | 2 |
2 files changed, 25 insertions, 6 deletions
@@ -135,14 +135,33 @@ You can record a regular video while using replay/streaming by launching GPU Scr To start/stop (and save) recording use the SIGRTMIN signal, for example `pkill -SIGRTMIN -f "^gpu-screen-recorder"`. The path to the video will be displayed in stdout when saving the video.\ This way of recording while using replay/streaming is more efficient than running GPU Screen Recorder multiple times since this way it only records the screen and encodes the video once. ## Controlling GPU Screen Recorder remotely +GPU Screen Recorder can be controlled with signals, or with commands over a unix domain socket when it's started with the `-ipc` option. +### Signals To save a video in replay mode, you need to send signal SIGUSR1 to gpu screen recorder. You can do this by running `pkill -SIGUSR1 -f "^gpu-screen-recorder"`.\ To stop recording send SIGINT to gpu screen recorder. You can do this by running `pkill -SIGINT -f "^gpu-screen-recorder"` or pressing `Ctrl-C` in the terminal that runs gpu screen recorder. When recording a regular non-replay video this will also save the video.\ To pause/unpause recording send SIGUSR2 to gpu screen recorder. You can do this by running `pkill -SIGUSR2 -f "^gpu-screen-recorder"`. This is only applicable and useful when recording (not streaming nor replay).\ -There are more signals to control GPU Screen Recorder. Run `gpu-screen-recorder --help` to list them all (under `NOTES` section).\ -GPU Screen Recorder can also be controlled with json messages over a unix domain socket by launching it with the `-ipc` option, for example `-ipc "$XDG_RUNTIME_DIR/gsr.sock"`. -This gives the same control as the signals, except that a replay can be saved with an arbitrary number of seconds and that you get a reply that says if the command succeeded.\ -The `gsr-cli` program sends these commands, for example `gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" save-replay 30`. It can also check if GPU Screen Recorder is running with `gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" status`.\ -See `man gsr-cli` for all commands and the `IPC` section in `man gpu-screen-recorder` for the protocol, if you want to talk to the socket directly instead of using `gsr-cli`. +There are more signals to control GPU Screen Recorder. Run `gpu-screen-recorder --help` to list them all (under `NOTES` section). +### IPC +Start GPU Screen Recorder with the `-ipc` option to also make it listen for commands on a unix domain socket, for example:\ +``` +gpu-screen-recorder -w screen -f 60 -c mp4 -r 60 -o ~/Videos -ipc "$XDG_RUNTIME_DIR/gsr.sock" +``` +and then use the `gsr-cli` program to send commands to it:\ +``` +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" save-replay 30 +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" save-replay +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" toggle-replay-recording +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" toggle-pause +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" stop +gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" status +``` +This gives the same control as the signals, with these differences: +* `save-replay` takes the number of seconds to save, instead of the fixed times that the signals provide. The whole replay buffer is saved when no number of seconds is given. +* `gsr-cli` exits with 0 only when the command succeeded and prints the reason to stderr when it didn't, so commands don't have to be sent blindly. +* `status` prints `running` or `not running` and exits with 0 when GPU Screen Recorder is running, which a script can use to only start replay when it isn't already running: `gsr-cli -ipc "$XDG_RUNTIME_DIR/gsr.sock" status >/dev/null || start-replay.sh`. +* The commands are sent to one specific GPU Screen Recorder instance instead of every instance that `pkill` matches. + +Run `man gsr-cli` to see all commands. The commands are newline terminated json messages, which are described in the `IPC` section of `man gpu-screen-recorder` if you want to talk to the socket directly instead of using `gsr-cli`. ## Simple way to run replay without gui Run the script `scripts/start-replay.sh` to start replay and then `scripts/save-replay.sh` to save a replay and `scripts/stop-replay.sh` to stop the replay. The videos are saved to `$HOME/Videos`. You can use these scripts to start replay at system startup if you add `scripts/start-replay.sh` to startup (this can be done differently depending on your desktop environment / window manager) and then go into diff --git a/src/recorder/recorder.c b/src/recorder/recorder.c index 6f9ea12..4426ac5 100644 --- a/src/recorder/recorder.c +++ b/src/recorder/recorder.c @@ -511,7 +511,7 @@ static void recorder_update_fps_counters(gsr_recorder *self) { const double elapsed = time_now - self->fps_start_time; if (elapsed >= 1.0) { if(self->settings.verbose) { - fprintf(stderr, "update fps: %d, damage fps: %d\n", self->fps_counter, self->damage_fps_counter); + gsr_log(GSR_LOG_LEVEL_INFO, "update fps: %d, damage fps: %d", self->fps_counter, self->damage_fps_counter); } self->fps_start_time = time_now; self->fps_counter = 0; |
