scripts/rec: use fish/vaapi

This commit is contained in:
Michele Guerini Rocco 2021-07-27 17:49:48 +02:00
parent d2ed4ab1f3
commit 6506100746
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -1,17 +1,19 @@
#!/bin/sh #!/usr/bin/env fish
record() { function record
sleep 2 sleep 2
ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0 -f alsa -i recorder \ withcap sys_admin -- ffmpeg -f alsa -i recorder \
-c:v libx264 -preset ultrafast \ -vaapi_device /dev/dri/renderD128 -f kmsgrab -i - -r 60 \
-vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' \
-c:v hevc_vaapi -qp 21 \
-c:a libopus -b:a 96k -ac 2 -ar 48000 \ -c:a libopus -b:a 96k -ac 2 -ar 48000 \
-y recording.mkv >/dev/null 2>&1 & -y recording.mkv >/dev/null 2>&1 &
} end
if test "$1" = start; then if test ! -f recording.mkv
fish -ic 'set -U AUDIO record' set -xU AUDIO_OUT record
record & record
else else
fish -ic 'set -U AUDIO' set -xU AUDIO_OUT
pkill ffmpeg pkill ffmpeg
fi end