From b8f2c418238af1b784b160d70bc60e4f3d2a61f3 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 28 Feb 2019 18:34:01 +0100 Subject: Created screen recording scripts. --- getResolution.sh | 3 +++ i3blocks/i3rec.sh | 13 +++++++++++++ screenRecord.sh | 15 +++++++++++++++ stopScreenRecord.sh | 15 +++++++++++++++ 4 files changed, 46 insertions(+) create mode 100755 getResolution.sh create mode 100755 i3blocks/i3rec.sh create mode 100755 screenRecord.sh create mode 100755 stopScreenRecord.sh diff --git a/getResolution.sh b/getResolution.sh new file mode 100755 index 0000000..5f81333 --- /dev/null +++ b/getResolution.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +xrandr | grep '*' | awk '{print $1}' diff --git a/i3blocks/i3rec.sh b/i3blocks/i3rec.sh new file mode 100755 index 0000000..82fede7 --- /dev/null +++ b/i3blocks/i3rec.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Shows status of ffmpeg screen recording + +#case $BLOCK_BUTTON in +# 1) # Left click +# 2) # Middle click +# 3) # Right click +#esac + +MARKFILE='/tmp/screenRec.mark' +[ -e $MARKFILE ] && echo "🎥✔️" && exit 0 +echo "" diff --git a/screenRecord.sh b/screenRecord.sh new file mode 100755 index 0000000..710d47e --- /dev/null +++ b/screenRecord.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +MARKFILE='/tmp/screenRec.mark' +# Check if already recording +if [ -e $MARKFILE ]; then + stopScreenRecord.sh +else + touch $MARKFILE + filename=rec"$(date +"%y-%m-%d_%H-%M-%S")".mp4 + # also record microphone + # ffmpeg -video_size "$(getResolution.sh)" -framerate 30 -f x11grab -i :0.0+0,0 -f alsa -ac 2 -i hw:0,0 "$HOME/videos/recs/$filename" & + ffmpeg -video_size "$(getResolution.sh)" -framerate 30 -f x11grab -i :0.0+0,0 "$HOME/videos/recs/$filename" & + notify-send -t 1000 "Recording $filename" + pkill -SIGRTMIN+13 i3blocks +fi diff --git a/stopScreenRecord.sh b/stopScreenRecord.sh new file mode 100755 index 0000000..680f2f4 --- /dev/null +++ b/stopScreenRecord.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +MARKFILE='/tmp/screenRec.mark' +# Terminate ffmpeg processes +for process in $(pgrep -x ffmpeg) +do + kill "$process" && notify-send -t 1000 "ffmpeg $process stopped." +done +# Terminate screenRecord.sh processes +for process in $(pgrep -x screenRecord.sh) +do + kill "$process" && notify-send -t 1000 "Recording $process stopped." +done +rm $MARKFILE +pkill -SIGRTMIN+13 i3blocks -- cgit v1.2.1