Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions recorder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ if pidof ffmpeg
time=$(date +%F%T)


for p in $(pgrep -t $(cat /sys/class/tty/tty0/active));
do
d=$(awk -v RS='\0' -F= '$1=="DISPLAY" {print $2}' /proc/$p/environ 2>/dev/null);
[[ -n $d ]] && break;
done;

# only start recording if we give a width (e.g we press escape to get out of slop - don't record)
width=${#W}

Expand All @@ -21,8 +27,8 @@ if pidof ffmpeg

# records without audio input
# for audio add "-f alsa -i pulse" to the line below (at the end before \, without "")
ffmpeg -f x11grab -s "$W"x"$H" -framerate 60 -thread_queue_size 512 -i $DISPLAY.0+$X,$Y \
ffmpeg -f x11grab -s "$W"x"$H" -framerate 60 -thread_queue_size 512 -i $d.0+$X,$Y \
-vcodec libx264 -qp 18 -preset ultrafast \
~/Videos/recording-$time.mp4
~/Videos/recording-$time.mp4 || notify-send 'Recording failed!' --icon=dialog-information
fi
fi