diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-25 01:16:13 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-25 01:16:13 +0200 |
commit | 4be9d55ad63853dd1562ab4f0537b0b403aa9ca5 (patch) | |
tree | f9d700c5afa50cf98f9af05f0927712004a83730 /bin/guiscripts/record | |
parent | 3ee8ba1eccb086d5b8dd8e3aa765635f5ca15c53 (diff) |
checkpoint
Diffstat (limited to 'bin/guiscripts/record')
-rwxr-xr-x | bin/guiscripts/record | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/bin/guiscripts/record b/bin/guiscripts/record deleted file mode 100755 index f01a5c7..0000000 --- a/bin/guiscripts/record +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh - -# record - record an area of the screen - -lock="/tmp/record.lock" - -# dependencies: ffmpeg, hacksaw (part), xwininfo & lsw (window), xdotool (active) -# optional: -# - hacksaw: part -# - xwininfo, lsw, commander: window -# - xdotool: active -# - xdg-user-dir - -audio= - -# $1: width -# $2: height -# $3: x -# $4: y -# $5: output dir -# $6: output name -record_cmd() -{ - if [ -f "$lock" ] - then - >&2 printf 'already recording, please stop recording first\n' - exit 1 - else - touch "$lock" - fi - - herbe "started recording." & - w=$(($3 + $3 % 2)) - h=$(($4 + $4 % 2)) - ffmpeg $audio \ - -v 16 \ - -r 30 \ - -f x11grab \ - -s "${w}x${h}" \ - -i ":0.0+$1,$2" \ - -preset slow \ - -c:v h264 \ - -pix_fmt yuv420p \ - -crf 20 \ - "$5/$6.mp4" - printf '%s\n' "$5/$6.mp4" - rm -f "$lock" - herbe "stopped recording." & -} - -if [ -d "$1" ] -then - dir="$1" - shift -else - dir="$(which xdg-user-dir > /dev/null 2>&1 && xdg-user-dir VIDEOS)" - [ "$dir" ] && dir="$dir/records" || dir="$HOME/vids/records" -fi -mkdir -p "$dir" - -if [ "$1" = "-a" ] -then - audio="-f pulse -ac 2 -i default" - shift -fi - -if [ "$1" = "-l" ] -then - find vids/records/ -type f | sort | tail -n 1 - exit -fi - -current=$(date +%F_%H-%M-%S) - -[ "$1" ] && option="$1" || option="$(printf 'active\nwindow\npart\nstop\nfull\naudio' | commander -c)" -case "$option" in - active) - record_cmd $(xwininfo -id "$(xdotool getactivewindow)" | - sed -e '/Absolute\|Width:\|Height:/!d;s/.*:\s*//' | tr '\n' ' ') $dir $current - ;; - - window) - winid="$(lsw | commander -cxl | cut -d' ' -f1)" - [ "$winid" ] || exit 1 - values="$(xwininfo -id "$winid" | sed -e '/Absolute\|Width:\|Height:/!d;s/.*:\s*//' | tr '\n' ' ')" - [ "$values" ] || exit 1 - record_cmd $values $dir $current - ;; - - part) - hacksaw | { - IFS=+x read -r w h x y - record_cmd $w $h $x $y $dir $current - } - ;; - stop) - pid="$(pgrep ffmpeg | xargs ps | grep 'x11grab' | awk '{print $1}')" - [ "$pid" ] && kill "$pid" - rm -f "$lock" - ;; - full) record_cmd 0 0 1920 1080 $dir $current ;; - audio) $0 -a; exit ;; - help|*) >&2 printf 'record [dir] (active|window|part|stop|full)\n' ;; -esac |