22 lines
632 B
Bash
Executable File
22 lines
632 B
Bash
Executable File
#/bin/sh
|
|
|
|
# Adjust the GPU encoding with -c:v hevc_amf
|
|
# To see the list of available encoders: ffmpeg -encoders | grep -E "h264|hevc"
|
|
|
|
PIDFILE="/tmp/screen_recorder.pid"
|
|
|
|
mkdir -p ~/Videos
|
|
|
|
if [ -f "$PIDFILE" ]; then
|
|
kill -2 "$(cat "$PIDFILE")"
|
|
rm "$PIDFILE"
|
|
else
|
|
ffmpeg -nostdin -hide_banner -loglevel quiet -nostats \
|
|
-f x11grab -framerate 24 -i :0.0 -f pulse \
|
|
-i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor \
|
|
-c:v hevc_amf -c:v libx264 -preset ultrafast -crf 28 \
|
|
-pix_fmt yuv420p -c:a aac -b:a 128k \
|
|
~/Videos/$(date +%Y%m%d_%H%M%S).mp4 &
|
|
echo $! > "$PIDFILE"
|
|
fi
|