dotfiles/home/dot_local/bin/executable_screc

36 lines
848 B
Text
Raw Normal View History

2025-09-18 10:28:19 +01:00
#!/bin/sh
# Take a screen recording in webm format using wf-recorder
# The output file is echo'd to stdout and the path copied
# using the text/uri-list mimetype to the clipboard.
tmpd=$(mktemp -d -t screc.XXXXXX)
outfile="${tmpd}/out.webm"
2025-10-09 20:00:00 +01:00
intermediate="${tmpd}/int.mkv"
2025-09-18 10:28:19 +01:00
geometry=$(slurp)
2025-10-09 20:00:00 +01:00
wf-recorder -g "$geometry" -f "$intermediate" &
2025-09-18 10:28:19 +01:00
recpid=$!
read -sn1 -p 'Press any key to stop recording:'
echo
kill $recpid
2025-10-09 20:00:00 +01:00
ffmpeg -i $intermediate -r 10 -c:v libvpx-vp9 -row-mt 1 -b:v 0 -pass 1 -an -f null /dev/null
ffmpeg -i $intermediate -r 10 -c:v libvpx-vp9 -row-mt 1 -b:v 0 -pass 2 -crf 30 $outfile
2025-09-18 10:28:19 +01:00
echo "$outfile"
wl-copy -t text/uri-list "file://$outfile"
2025-10-09 20:00:00 +01:00
notify-send --expire-time 10000 \
--app-name=Screc \
"Recording Ready" \
"Screen recording saved to $outfile and copied to clipboard"
2025-09-18 10:28:19 +01:00
(sleep 60 && rm -r $tmpd) &
disown