From 6b3555e44f61adc6cfe3de901b02e127bd23b146 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sat, 12 Dec 2020 14:36:41 +0100 Subject: Updated screen record scripts to record 1080p monitor when two present. --- screenRecord.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'screenRecord.sh') diff --git a/screenRecord.sh b/screenRecord.sh index 3abbf7b..e1dc923 100755 --- a/screenRecord.sh +++ b/screenRecord.sh @@ -1,17 +1,29 @@ #!/bin/sh -MARKFILE='/tmp/screenRec.mark' +markfile='/tmp/screenRec.mark' recsFolder="$HOME/videos/recs" + # Check if already recording -if [ -e $MARKFILE ]; then - stopScreenRecord.sh -else - touch $MARKFILE - mkdir -p "$recsFolder" - filename=rec"$(date +"%y-%m-%d_%H-%M-%S")".mkv - # 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 -vcodec libx264 "$recsFolder/$filename" & - notify-send -t 1000 "Recording $filename" - pkill -SIGRTMIN+13 i3blocks +[ -e "$markfile" ] && stopScreenRecord.sh && exit 0 + +touch "$markfile" +[ ! -d "$recsFolder" ] && mkdir -p "$recsFolder" + +filename="rec$(date +"%y-%m-%d_%H-%M-%S").mkv" + +screenRes="$(getResolution.sh)" +screenPos=":0.0" + +if [ "$(getResolution.sh | wc -l)" != 1 ]; then + screenRes="$(getResolution.sh | grep '1920x')" + screenPos=":0.0$(xrandr | grep -E "${screenRes}.*\(normal" | grep -Eo '\+[0-9]+\+[0-9]+')" fi + +echo $screenRes +echo $screenPos + +# 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 "$screenRes" -framerate 30 -f x11grab -i "$screenPos" -vcodec libx264 "${recsFolder}/${filename}" & + notify-send -t 1000 "Recording $filename" + pkill -SIGRTMIN+13 i3blocks -- cgit v1.2.1