add ffmpeg record-screen.sh

This commit is contained in:
oDinZu WenKi 2023-10-24 18:07:56 -04:00
parent b336189a98
commit 84275eca22

20
record-screen.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# License: GPL-3.0
# Author: oDinZu WenKi
# Get screen information
# xdpyinfo | grep "name" Note: $DISPLAY should match the name. e.g. :1
# Get detailed window information about screen specific window
# xwininfo
# Transforming mpeg format into .gif
# ffmpeg -i input.mp4 -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop -1 output.gif
# Check if script is already running
check="$(pgrep -fl ffmpeg)"
if [ -n "$check" ]; then
notify-send -t 1000 "FFmpeg Screen Recording has been stopped"
killall --user $USER --ignore-case --signal INT ffmpeg
else
notify-send -t 1000 "FFmpeg Screen Recording has been started"
ffmpeg -f x11grab -video_size 1920x1048 -framerate 60 -i $DISPLAY+0,365 -preset ultrafast $HOME/Videos/"$(date +%d_%m_%H:%M:%S)".mpeg
fi