Created
April 19, 2023 13:51
-
-
Save benyaminl/09ab88441531f75efcaaec01f521abfd to your computer and use it in GitHub Desktop.
Recording ffmpeg toggle from xfce keyboard map. If there are running ffmpeg for it, it will be killed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
record=$(pgrep -a ffmpeg | grep x11grab | awk "{print \$1}" | xargs -I {} echo {}) | |
if [ -z $record ]; | |
then | |
xwininfo | { | |
while IFS=: read -r k v; do | |
case "$k" in | |
*"Absolute upper-left X"*) x=$v;; | |
*"Absolute upper-left Y"*) y=$v;; | |
*"Border width"*) bw=$v ;; | |
*"Width"*) w=$v;; | |
*"Height"*) h=$v;; | |
esac | |
done | |
for i in 3 2 1; do echo "$i"; sleep 1; done | |
ffmpeg -y -f x11grab -framerate 24 \ | |
-video_size "$((w))x$((h))" \ | |
-i "+$((x+bw)),$((y+bw))" "$(date +%F\ %H:%M:%S).mp4" & | |
} | |
else | |
kill $record | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment