diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/interactive.sh | 17 | ||||
-rwxr-xr-x | scripts/list-sinks.sh | 3 | ||||
-rwxr-xr-x | scripts/replay.sh | 6 | ||||
-rwxr-xr-x | scripts/toggle-recording-selected.sh | 9 | ||||
-rwxr-xr-x | scripts/twitch-stream-local-copy.sh | 7 | ||||
-rwxr-xr-x | scripts/twitch-stream.sh | 5 | ||||
-rwxr-xr-x | scripts/youtube-hls-stream.sh | 11 |
7 files changed, 58 insertions, 0 deletions
diff --git a/scripts/interactive.sh b/scripts/interactive.sh new file mode 100755 index 0000000..63b0eae --- /dev/null +++ b/scripts/interactive.sh @@ -0,0 +1,17 @@ +#!/bin/sh -e + +selected_audio_input="$(pactl get-default-sink).monitor" + +echo "Select a window to record" +window_id=$(xdotool selectwindow) + +echo -n "Enter video fps: " +read fps + +echo -n "Enter output file name: " +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" diff --git a/scripts/list-sinks.sh b/scripts/list-sinks.sh new file mode 100755 index 0000000..e5fc44f --- /dev/null +++ b/scripts/list-sinks.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +pactl list | grep -E '(Description: Monitor of)|(Monitor Source: )' diff --git a/scripts/replay.sh b/scripts/replay.sh new file mode 100755 index 0000000..cf6c494 --- /dev/null +++ b/scripts/replay.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e + +[ "$#" -ne 4 ] && echo "usage: replay.sh <window_id> <fps> <replay_time_sec> <output_directory>" && exit 1 +active_sink="$(pactl get-default-sink).monitor" +mkdir -p "$4" +gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$active_sink" -r "$3" -o "$4" diff --git a/scripts/toggle-recording-selected.sh b/scripts/toggle-recording-selected.sh new file mode 100755 index 0000000..663f360 --- /dev/null +++ b/scripts/toggle-recording-selected.sh @@ -0,0 +1,9 @@ +#!/bin/sh -e + +killall -INT gpu-screen-recorder && notify-send -u low 'GPU Screen Recorder' 'Stopped recording' && exit 0; +window=$(xdotool selectwindow) +active_sink="$(pactl get-default-sink).monitor" +mkdir -p "$HOME/Videos" +video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" +notify-send -u low 'GPU Screen Recorder' "Started recording video to $video" +gpu-screen-recorder -w "$window" -c mp4 -f 60 -a "$active_sink" -o "$video" diff --git a/scripts/twitch-stream-local-copy.sh b/scripts/twitch-stream-local-copy.sh new file mode 100755 index 0000000..dba9d15 --- /dev/null +++ b/scripts/twitch-stream-local-copy.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# 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" +gpu-screen-recorder -w "$1" -c flv -f "$2" -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 new file mode 100755 index 0000000..cd4737a --- /dev/null +++ b/scripts/twitch-stream.sh @@ -0,0 +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" +gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" -o "rtmp://live.twitch.tv/app/$3" diff --git a/scripts/youtube-hls-stream.sh b/scripts/youtube-hls-stream.sh new file mode 100755 index 0000000..21619af --- /dev/null +++ b/scripts/youtube-hls-stream.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +[ "$#" -ne 3 ] && echo "usage: youtube-hls-stream.sh <window_id> <fps> <livestream_key>" && exit 1 +mkdir "youtube_stream" +cd "youtube_stream" +active_sink="$(pactl get-default-sink).monitor" +gpu-screen-recorder -w "$1" -c mpegts -f "$2" -a "$active_sink" | ffmpeg -i pipe:0 -c copy -f hls \ + -hls_time 2 -hls_flags independent_segments -hls_flags delete_segments -hls_segment_type mpegts -hls_segment_filename stream%02d.ts -master_pl_name stream.m3u8 out1 & +echo "Waiting until stream segments are created..." +sleep 10 +ffmpeg -i stream.m3u8 -c copy -- "https://a.upload.youtube.com/http_upload_hls?cid=$3©=0&file=stream.m3u8" |