Fix record start pattern
[khome.git] / home / bin / screencast
1 #!/bin/bash
2
3 set -e
4 set -o pipefail
5
6 DIR=~/arc/vid/screencasts
7 EXT=mkv
8 #EXT=ogv # Low quality for some reason
9
10 main() {
11 local response
12 printf 'Proceed? (Y/n)\n'
13 read -rsn 1 response
14 case "$response" in
15 '' | y | Y )
16 true;;
17 *)
18 exit 1;;
19 esac
20
21 local -r timestamp=$(date +'%Y-%m-%d--%H-%M-%S') || exit 1
22 local -r file_name="screen--${timestamp}.$EXT"
23 local -r file_path="$DIR"/"$file_name"
24 local -r slop=$(slop -f '%x %y %w %h') || exit 1
25
26 mkdir -p "$DIR"
27 read -r X Y W H <<< "$slop"
28 ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+"$X","$Y" -f pulse -ac 2 -i default "$file_path"
29 }
30
31 main "$@"
This page took 0.088495 seconds and 4 git commands to generate.