#!/bin/sh # references: # 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 # better notify-send? keep send notify-send when recording? or not # benchmark different encode codecs to choose a better one? # consider audio, camera ... # hardware acc? seems no for ffvhuff? see arch wiki # sbar wait signal approach? or not # reco sbar status? so no notify-send # use tmp instead? 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 ffmpeg -y -f x11grab -framerate 25 -i "$DISPLAY" -c:v ffvhuff "$tmpfile" & printf '%s\t%s' "$!" "$tmpfile" > "$infofile" fi