20 lines
521 B
Bash
Executable File
20 lines
521 B
Bash
Executable File
#/bin/sh
|
|
|
|
PIDFILE="/tmp/screen_recorder.pid"
|
|
|
|
mkdir -p ~/Videos
|
|
|
|
# if pkill -0 ffmpeg 2>/dev/null; then
|
|
|
|
if [ -f "$PIDFILE" ]; then
|
|
kill -2 "$(cat "$PIDFILE")"
|
|
rm "$PIDFILE"
|
|
else
|
|
ffmpeg -nostdin -hide_banner -loglevel quiet -nostats \
|
|
-f x11grab -framerate 30 -i :0.0 -f pulse \
|
|
-i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor \
|
|
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p -c:a aac \
|
|
-b:a 192k ~/Videos/$(date +%Y%m%d_%H%M%S).mp4 &
|
|
echo $! > "$PIDFILE"
|
|
fi
|