blob: 8f655141c46bc2dcc34185a19186f689ea77968d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/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 \
-f alsa -channels 1 -sample_rate 48000 \
-i hw:3 \
-c:v libx264 \
-c:a libopus \
-b:a 128k \
-preset ultrafast \
-qp 1 \
-pix_fmt yuv444p \
"$name"
|