summaryrefslogtreecommitdiff
path: root/video/screenrec
blob: fa6b628435c26cd88e91c03d18261c0fa2defd45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
newname() { defname="video"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`.mkv; }
[ -z "$1" ] && newname || name="$1"
# Get screen info. I suspect this script wouldn't work too well with multiple screens. Somebody else can add that
resinfo="$(xrandr | grep '*' | tr -s ' ')"
vs="$(echo "$resinfo" | cut -d' ' -f2)"
fr="$(echo "$resinfo" | sed 's/.*\s\([0-9]*\.[0-9]*\)\*.*/\1/')"
# -i is screen coordinates for top-leftmost screen
# Encoder settings are basically lossless and optimized for good speed, decent size, and great quality
# yuv444p colorspace is needed for a 24 bit rgb monitor, change for hdr. yuv420p is the default and is good for video, but is inadequate for screencasts
ffmpeg -hide_banner \
	-video_size $vs \
	-framerate $fr \
	-f x11grab \
	-i :0.0+0,0 \
	-c:v libx264 \
	-preset ultrafast \
	-qp 1 \
	-pix_fmt yuv444p \
	"$name"