diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | extra/gpu-screen-recorder.env | 4 | ||||
-rw-r--r-- | extra/gpu-screen-recorder.service | 5 | ||||
-rwxr-xr-x | scripts/interactive.sh | 4 | ||||
-rwxr-xr-x | scripts/record-application-name.sh | 2 | ||||
-rwxr-xr-x | scripts/record-save-application-name.sh | 2 | ||||
-rwxr-xr-x | scripts/replay-application-name.sh | 2 | ||||
-rwxr-xr-x | scripts/start-recording.sh | 2 | ||||
-rwxr-xr-x | scripts/start-replay.sh | 2 | ||||
-rwxr-xr-x | scripts/toggle-recording-selected.sh | 2 | ||||
-rwxr-xr-x | scripts/twitch-stream-local-copy.sh | 2 | ||||
-rwxr-xr-x | scripts/twitch-stream.sh | 2 | ||||
-rwxr-xr-x | scripts/youtube-hls-stream.sh | 2 | ||||
-rw-r--r-- | src/main.cpp | 10 |
14 files changed, 21 insertions, 22 deletions
@@ -94,7 +94,7 @@ When compiling GPU Screen Recorder with portal support (`-Dportal=true`, which i # How to use Run `gpu-screen-recorder --help` to see all options and also examples. ## Recording -Here is an example of how to record your monitor and the default audio output: `gpu-screen-recorder -w screen -f 60 -a "$(pactl get-default-sink).monitor" -o ~/Videos/test_video.mp4`. +Here is an example of how to record your monitor and the default audio output: `gpu-screen-recorder -w screen -f 60 -a default_output -o ~/Videos/test_video.mp4`. Yyou can stop and save the recording with `Ctrl+C` or by running `killall -SIGINT gpu-screen-recorder`. You can see a list of monitor names to record if you use an invalid monitor name, for example: `gpu-screen-recorder -w invalid -f 60 -o video.mp4`. ## Streaming diff --git a/extra/gpu-screen-recorder.env b/extra/gpu-screen-recorder.env index e542992..8ce1edb 100644 --- a/extra/gpu-screen-recorder.env +++ b/extra/gpu-screen-recorder.env @@ -3,8 +3,8 @@ CONTAINER=mp4 QUALITY=very_high CODEC=h264 AUDIO_CODEC=opus -AUDIO_DEVICE=alsa_output.pci-0000_0a_00.4.iec958-stereo.monitor -SECONDARY_AUDIO_DEVICE=alsa_input.some-mic.mono-fallback +AUDIO_DEVICE=default_output +SECONDARY_AUDIO_DEVICE=default_input FRAMERATE=60 REPLAYDURATION=60 OUTPUTDIR=/run/media/dec05eba/SSD1TB/Videos/aaaa diff --git a/extra/gpu-screen-recorder.service b/extra/gpu-screen-recorder.service index aa1d702..d0912ec 100644 --- a/extra/gpu-screen-recorder.service +++ b/extra/gpu-screen-recorder.service @@ -8,7 +8,7 @@ Environment=CONTAINER=mp4 Environment=QUALITY=very_high Environment=CODEC=auto Environment=AUDIO_CODEC=opus -Environment=AUDIO_DEVICE= +Environment=AUDIO_DEVICE=default_output Environment=SECONDARY_AUDIO_DEVICE= Environment=FRAMERATE=60 Environment=REPLAYDURATION=30 @@ -18,7 +18,8 @@ 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" -df "$MAKEFOLDERS" $ADDITIONAL_ARGS -cr "$COLOR_RANGE" -keyint "$KEYINT" -restore-portal-session "$RESTORE_PORTAL_SESSION" -encoder "$ENCODER"' +Environment=ADDITIONAL_ARGS= +ExecStart=gpu-screen-recorder -v no -w "${WINDOW}" -c "${CONTAINER}" -q "${QUALITY}" -k "${CODEC}" -ac "${AUDIO_CODEC}" -a "${AUDIO_DEVICE}" -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/scripts/interactive.sh b/scripts/interactive.sh index 63b0eae..bfaaae0 100755 --- a/scripts/interactive.sh +++ b/scripts/interactive.sh @@ -1,7 +1,5 @@ #!/bin/sh -e -selected_audio_input="$(pactl get-default-sink).monitor" - echo "Select a window to record" window_id=$(xdotool selectwindow) @@ -14,4 +12,4 @@ read output_file_name output_dir=$(dirname "$output_file_name") mkdir -p "$output_dir" -gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" -o "$output_file_name" +gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a default_output -o "$output_file_name" diff --git a/scripts/record-application-name.sh b/scripts/record-application-name.sh index cc29255..4139c9c 100755 --- a/scripts/record-application-name.sh +++ b/scripts/record-application-name.sh @@ -3,4 +3,4 @@ window=$(xdotool selectwindow) window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$window" || echo "Game") window_name="$(echo "$window_name" | tr '/\\' '_')" -gpu-screen-recorder -w "$window" -f 60 -a "$(pactl get-default-sink).monitor" -o "$HOME/Videos/recording/$window_name/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" +gpu-screen-recorder -w "$window" -f 60 -a default_output -o "$HOME/Videos/recording/$window_name/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" diff --git a/scripts/record-save-application-name.sh b/scripts/record-save-application-name.sh index 46c51f0..b814809 100755 --- a/scripts/record-save-application-name.sh +++ b/scripts/record-save-application-name.sh @@ -1,7 +1,7 @@ #!/bin/sh # This script should be passed to gpu-screen-recorder with the -sc option, for example: -# gpu-screen-recorder -w screen -f 60 -a "$(pactl get-default-sink).monitor" -r 60 -sc scripts/record-save-application-name.sh -c mp4 -o "$HOME/Videos" +# gpu-screen-recorder -w screen -f 60 -a default_output -r 60 -sc scripts/record-save-application-name.sh -c mp4 -o "$HOME/Videos" window=$(xdotool getwindowfocus) window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$window" || echo "Game") diff --git a/scripts/replay-application-name.sh b/scripts/replay-application-name.sh index 18df61a..9f363f7 100755 --- a/scripts/replay-application-name.sh +++ b/scripts/replay-application-name.sh @@ -3,4 +3,4 @@ window=$(xdotool selectwindow) window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$window" || echo "Game") window_name="$(echo "$window_name" | tr '/\\' '_')" -gpu-screen-recorder -w "$window" -f 60 -c mkv -a "$(pactl get-default-sink).monitor" -r 60 -o "$HOME/Videos/Replays/$window_name" +gpu-screen-recorder -w "$window" -f 60 -c mkv -a default_output -r 60 -o "$HOME/Videos/Replays/$window_name" diff --git a/scripts/start-recording.sh b/scripts/start-recording.sh index 455065e..bf71d62 100755 --- a/scripts/start-recording.sh +++ b/scripts/start-recording.sh @@ -2,4 +2,4 @@ pidof -q gpu-screen-recorder && exit 1 video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" -gpu-screen-recorder -w screen -f 60 -a "$(pactl get-default-sink).monitor" -o "$video" +gpu-screen-recorder -w screen -f 60 -a default_output -o "$video" diff --git a/scripts/start-replay.sh b/scripts/start-replay.sh index 2093c98..6c03178 100755 --- a/scripts/start-replay.sh +++ b/scripts/start-replay.sh @@ -3,4 +3,4 @@ pidof -q gpu-screen-recorder && exit 1 video_path="$HOME/Videos" mkdir -p "$video_path" -gpu-screen-recorder -w screen -f 60 -a "$(pactl get-default-sink).monitor" -c mkv -r 30 -o "$video_path" +gpu-screen-recorder -w screen -f 60 -a default_output -c mkv -r 30 -o "$video_path" diff --git a/scripts/toggle-recording-selected.sh b/scripts/toggle-recording-selected.sh index 309e4d1..d4c1b38 100755 --- a/scripts/toggle-recording-selected.sh +++ b/scripts/toggle-recording-selected.sh @@ -2,7 +2,7 @@ killall -SIGINT gpu-screen-recorder && sleep 0.5 && notify-send -t 1500 -u low 'GPU Screen Recorder' 'Stopped recording' && exit 0; window=$(xdotool selectwindow) -active_sink="$(pactl get-default-sink).monitor" +active_sink=default_output mkdir -p "$HOME/Videos" video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" notify-send -t 1500 -u low 'GPU Screen Recorder' "Started recording video to $video" diff --git a/scripts/twitch-stream-local-copy.sh b/scripts/twitch-stream-local-copy.sh index 4a678e8..fa23cf6 100755 --- a/scripts/twitch-stream-local-copy.sh +++ b/scripts/twitch-stream-local-copy.sh @@ -3,5 +3,5 @@ # Stream on twitch while also saving the video to disk locally [ "$#" -ne 4 ] && echo "usage: twitch-stream-local-copy.sh <window_id> <fps> <livestream_key> <local_file>" && exit 1 -active_sink="$(pactl get-default-sink).monitor" +active_sink=default_output gpu-screen-recorder -w "$1" -c flv -f "$2" -q high -a "$active_sink" | tee -- "$4" | ffmpeg -i pipe:0 -c copy -f flv -- "rtmp://live.twitch.tv/app/$3" diff --git a/scripts/twitch-stream.sh b/scripts/twitch-stream.sh index aaa5828..99dade8 100755 --- a/scripts/twitch-stream.sh +++ b/scripts/twitch-stream.sh @@ -1,5 +1,5 @@ #!/bin/sh [ "$#" -ne 3 ] && echo "usage: twitch-stream.sh <window_id> <fps> <livestream_key>" && exit 1 -active_sink="$(pactl get-default-sink).monitor" +active_sink=default_output gpu-screen-recorder -w "$1" -c flv -f "$2" -q high -a "$active_sink" -o "rtmp://live.twitch.tv/app/$3" diff --git a/scripts/youtube-hls-stream.sh b/scripts/youtube-hls-stream.sh index 2f1659e..10fa6b2 100755 --- a/scripts/youtube-hls-stream.sh +++ b/scripts/youtube-hls-stream.sh @@ -1,5 +1,5 @@ #!/bin/sh [ "$#" -ne 3 ] && echo "usage: youtube-hls-stream.sh <window_id> <fps> <livestream_key>" && exit 1 -active_sink="$(pactl get-default-sink).monitor" +active_sink=default_output gpu-screen-recorder -w "$1" -c hls -f "$2" -q high -a "$active_sink" -ac aac -o "https://a.upload.youtube.com/http_upload_hls?cid=$3©=0&file=stream.m3u8"
\ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 8ab34ba..db44530 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1049,11 +1049,11 @@ static void usage_full() { fprintf(stderr, " Send signal SIGUSR2 to gpu-screen-recorder (killall -SIGUSR2 gpu-screen-recorder) to pause/unpause recording. Only applicable and useful when recording (not streaming nor replay).\n"); fprintf(stderr, "\n"); fprintf(stderr, "EXAMPLES:\n"); - fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -o \"$HOME/Videos/video.mp4\"\n", program_name); - fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor|$(pactl get-default-source)\" -o \"$HOME/Videos/video.mp4\"\n", program_name); - fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -c mkv -r 60 -o \"$HOME/Videos\"\n", program_name); - fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -c mkv -sc script.sh -r 60 -o \"$HOME/Videos\"\n", program_name); - fprintf(stderr, " %s -w portal -f 60 -a \"$(pactl get-default-sink).monitor\" -restore-portal-session yes -o \"$HOME/Videos/video.mp4\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a default_output -o \"$HOME/Videos/video.mp4\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a \"default_output|default_input\" -o \"$HOME/Videos/video.mp4\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a default_output -c mkv -r 60 -o \"$HOME/Videos\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a default_output -c mkv -sc script.sh -r 60 -o \"$HOME/Videos\"\n", program_name); + fprintf(stderr, " %s -w portal -f 60 -a default_output -restore-portal-session yes -o \"$HOME/Videos/video.mp4\"\n", program_name); //fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -q ultra -pixfmt yuv444 -o video.mp4\n"); _exit(1); } |