diff options
Diffstat (limited to 'home/xyz/.local/bin/reco')
-rwxr-xr-x | home/xyz/.local/bin/reco | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/home/xyz/.local/bin/reco b/home/xyz/.local/bin/reco new file mode 100755 index 00000000..d56e61c2 --- /dev/null +++ b/home/xyz/.local/bin/reco @@ -0,0 +1,27 @@ +#!/bin/sh + +# useful urls: +# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/dmenurecord +# https://wiki.archlinux.org/title/FFmpeg#Screen_capture +# https://trac.ffmpeg.org/wiki/Capture/Desktop + +infofile="/tmp/recoinfo" +recodir="$XDG_VIDEOS_DIR/recordings/" +mkdir -p "$recodir" + +if [ -e "$infofile" ]; then + read -r pid tmpfile < "$infofile" + kill "$pid" + notify-send 'finish recording, start converting' + ffmpeg -i "$tmpfile" "$recodir/$(time.uuid).mkv" + notify-send 'finish converting' + rm "$tmpfile" "$infofile" +else + tmpfile="$(mktemp --suffix '.mkv')" + notify-send 'start recording' + # arch wiki way, no audio, less cpu use during capturing (fast?), large file size, need convert afterward + xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2"x"$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1" & echo $!' shell "$tmpfile" | xargs -I {} printf '%s\t%s' '{}' "$tmpfile" > "$infofile" + # another way to get subshell ffmpeg child pid + #xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -f x11grab -framerate 25 -s "$2"x"$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1"' shell "$tmpfile" & + #printf '%s\t%s' "$(ps -o pid= --ppid $!)" "$tmpfile" > "$infofile" +fi |