Update slop-ffmpeg-area

main
Ian Mancini 4 years ago
parent afb609813d
commit b5e1283433

@ -2,14 +2,14 @@
SCREENCAST_PID_FILE="$HOME/.screencast-pid" SCREENCAST_PID_FILE="$HOME/.screencast-pid"
if [ -f $SCREENCAST_PID_FILE ]; then if [ -f "$SCREENCAST_PID_FILE" ]; then
notify-send "Stopping screencast" notify-send "Stopping screencast"
pid=$(cat $SCREENCAST_PID_FILE) pid=$(cat "$SCREENCAST_PID_FILE")
kill $pid kill "$pid"
tail --pid=$pid -f /dev/null tail --pid="$pid" -f /dev/null
rm $SCREENCAST_PID_FILE rm "$SCREENCAST_PID_FILE"
notify-send "Screencast stopped" notify-send "Screencast stopped"
exit 0 exit 0
fi fi
DIR="$HOME/Videos/screencasts/" DIR="$HOME/Videos/screencasts/"
@ -19,16 +19,16 @@ FILENAME="$DIR$DATE.mp4"
slop=$(slop -f "%x %y %w %h %g %i") || exit 1 slop=$(slop -f "%x %y %w %h %g %i") || exit 1
[[ $? = 1 ]] && notify-send "Screencast cancelled" && exit 1 [[ $? = 1 ]] && notify-send "Screencast cancelled" && exit 1
notify-send "Starting screencast" notify-send "Starting screencast"
touch $HOME/.screencast-pid touch "$HOME/.screencast-pid"
read -r X Y W H G ID < <(echo $slop) # shellcheck disable=SC2034
((ffmpeg -y -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f pulse -i 1 $FILENAME) & jobs -p > $SCREENCAST_PID_FILE) read -r X Y W H G ID < <(echo "$slop")
[ ! $((W%2)) -eq 0 ] && W=$((W-1)); [ ! $((H%2)) -eq 0 ] && H=$((H-1))
while [ -f $SCREENCAST_PID_FILE ]; do ( (ffmpeg -y -f x11grab -s "$W"x"$H" -i :0.0+"$X","$Y" -f pulse -i 2 -vf format=yuv420p -profile:v baseline "$FILENAME") & jobs -p > "$SCREENCAST_PID_FILE" )
sleep 1
while [ -f "$SCREENCAST_PID_FILE" ]; do
sleep 1
done done
# xclip -selection clipboard -t video/mp4 "$FILENAME" # xclip -selection clipboard -t video/mp4 "$FILENAME"
dragon-drag-and-drop $FILENAME dragon-drag-and-drop "$FILENAME"
notify-send "Saved screencast" "$DATE.mp4" notify-send "Saved screencast" "$DATE.mp4"

Loading…
Cancel
Save