-
Notifications
You must be signed in to change notification settings - Fork 2
/
term-rec.sh
35 lines (28 loc) · 819 Bytes
/
term-rec.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# record borderless gnome-terminal window
FFMPEG="/media/$USER/local/apps/ffmpeg"
echo select a terminal window to start recording ...
echo [ press CTRL+C to stop ]
# crop borders (no tabs)
PX=26
PY=70
PW=52
PH=99
xwininfo | {
while IFS=: read -r k v; do
case "$k" in
*"Absolute upper-left X"*) x=$v;;
*"Absolute upper-left Y"*) y=$v;;
*"Border width"*) bw=$v;;
*"Width"*) w=$v;;
*"Height"*) h=$v;;
esac
done
for i in 3 2 1; do echo "$i"; sleep 1; done
echo "start recording ..."; sleep 1;
$FFMPEG -y -f x11grab -show_region 1 -framerate 20 \
-video_size "$((w-$PW))x$((h-$PH))" \
-i "+$((x+$PX)),$((y+$PY))" \
-lossless 1 \
~/Downloads/termrec.webp
}