summaryrefslogtreecommitdiff
path: root/video/screenrec
diff options
context:
space:
mode:
Diffstat (limited to 'video/screenrec')
-rwxr-xr-xvideo/screenrec20
1 files changed, 17 insertions, 3 deletions
diff --git a/video/screenrec b/video/screenrec
index 91edcd0..fa6b628 100755
--- a/video/screenrec
+++ b/video/screenrec
@@ -1,6 +1,20 @@
#!/bin/sh
newname() { defname="video"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`.mkv; }
-vs=`cat /sys/class/drm/*/modes | head -1`
-vs=1366x768
[ -z "$1" ] && newname || name="$1"
-ffmpeg -hide_banner -video_size $vs -framerate 60 -f x11grab -i :0.0+0,0 -c:v libx264 -preset ultrafast -qp 1 -pix_fmt yuv444p "$name"
+# 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"