Add generating .dummy.aac

This commit is contained in:
hok7z 2022-12-04 22:08:04 +02:00
parent a97ae06051
commit e56d5185c4
1 changed files with 12 additions and 7 deletions

View File

@ -1,18 +1,24 @@
#!/bin/sh
PID_FILE="/tmp/screencast.pid"
SCREENCAST_FILE="$HOME/Video/$(date +'%Y-%m-%d_%H:%M').mp4"
SCREENCAST_FILE="$HOME/Videos/$(date +'%Y-%m-%d_%H:%M').mp4"
if [ ! -e ~/.dummy.aac ]; then
ffmpeg -f lavfi -i anullsrc=r=11025:cl=mono -t 1 -acodec aac ~/.dummy.aac
echo "[+] dummy.aac generated"
fi
if [ -e $PID_FILE ]; then
notify-send "Screen record was ended"
kill -s INT "$(cat $PID_FILE)"
dragon-drop "$(cat /tmp/screencast.filename)"
notify-send "Screen record was ended" -t 2000
dragon "$(cat /tmp/screencast.filename)"
rm -- "${PID_FILE}"
else
geometry=$(slop -c 0.7411764705882353,0.5764705882352941,0.9764705882352941,0.1 \
-b 1.5 --color=255,0,255 -o -D -f "-video_size %wx%h -i :0.0+%x,%y")
#shellcheck disable=SC2181
if [ $? -eq 0 ] ;then
#shellcheck disable=SC2086
notify-send "Screen recording started" -i "$HOME/.config/dunst/icons/record.png" -t 1000
ffmpeg -y -thread_queue_size 65536 \
-f x11grab $geometry -i ~/.dummy.aac -c:a copy \
-c:v libx264 -vf "scale=force_original_aspect_ratio=decrease:force_divisible_by=2" -preset slow -crf 18 -pix_fmt yuv420p \
@ -20,8 +26,7 @@ else
"${SCREENCAST_FILE}" >/dev/null 2>/dev/null &
echo $! > $PID_FILE
echo "${SCREENCAST_FILE}" > /tmp/screencast.filename
notify-send "Screen recording started" -i "$HOME/.config/dunst/icons/record.png"
else
notify-send "Screen record was canceled" -i "$HOME/.config/dunst/icons/cancel.png"
notify-send "Screen record was canceled" -i "$HOME/.config/dunst/icons/cancel.png" -t 2000
fi
fi