1
0
Fork 0
This commit is contained in:
Luca Bilke 2024-04-14 03:04:37 +02:00
parent 72f3c6d785
commit 950c644892
1 changed files with 21 additions and 19 deletions

View File

@ -28,6 +28,7 @@ killrecording() {
} }
screencast() { screencast() {
mkdir -p "$XDG_VIDEOS_DIR/Captures"
ffmpeg -y \ ffmpeg -y \
-f x11grab \ -f x11grab \
-framerate 60 \ -framerate 60 \
@ -36,20 +37,21 @@ screencast() {
-f alsa -i default \ -f alsa -i default \
-r 30 \ -r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \ -c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & "$XDG_VIDEOS_DIR/Captures/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid echo $! >/tmp/recordingpid
updateicon "" updateicon "󰍹 󰍬"
} }
video() { video() {
mkdir -p "$XDG_VIDEOS_DIR/Captures"
ffmpeg \ ffmpeg \
-f x11grab \ -f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \ -i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \ -c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & "$XDG_VIDEOS_DIR/Captures/video-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid echo $! >/tmp/recordingpid
updateicon "" updateicon "󰍹"
} }
webcamhidef() { webcamhidef() {
@ -59,7 +61,7 @@ webcamhidef() {
-video_size 1920x1080 \ -video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid echo $! >/tmp/recordingpid
updateicon "" updateicon "󰄀"
} }
webcam() { webcam() {
@ -69,7 +71,7 @@ webcam() {
-video_size 640x480 \ -video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid echo $! >/tmp/recordingpid
updateicon "" updateicon "󰖠"
} }
audio() { audio() {
@ -78,18 +80,18 @@ audio() {
-c:a flac \ -c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! >/tmp/recordingpid echo $! >/tmp/recordingpid
updateicon "" updateicon "󰍬"
} }
askrecording() { askrecording() {
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in case "$choice" in
screencast) screencast ;; screencast) screencast ;;
audio) audio ;; audio) audio ;;
video) video ;; video) video ;;
*selected) videoselected ;; *selected) videoselected ;;
webcam) webcam ;; webcam) webcam ;;
"webcam (hi-def)") webcamhidef ;; "webcam (hi-def)") webcamhidef ;;
esac esac
} }
@ -115,10 +117,10 @@ videoselected() {
} }
case "$1" in case "$1" in
screencast) screencast ;; screencast) screencast ;;
audio) audio ;; audio) audio ;;
video) video ;; video) video ;;
*selected) videoselected ;; *selected) videoselected ;;
kill) killrecording ;; kill) killrecording ;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;; *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;;
esac esac