-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord
More file actions
executable file
·31 lines (25 loc) · 829 Bytes
/
record
File metadata and controls
executable file
·31 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
save_dir="$HOME/media/Videos/Recordings"
mkdir -p "$save_dir"
pidfile="/tmp/ffmpeg-screen-record.pid"
if [ -f "$pidfile" ]; then
kill -INT "$(cat "$pidfile")" 2>/dev/null
rm "$pidfile"
notify-send "Screen Recording Stopped"
exit 0
fi
name=$(echo "" | dmenu -p "Recording name:")
[ -z "$name" ] && name="untitled_$(date '+%Y-%m-%d_%H-%M-%S')"
audio_src="$(pactl get-default-sink).monitor"
screen_size=$(xdpyinfo | awk '/dimensions:/ {print $2}')
outfile="$save_dir/${name// /_}.mkv"
notify-send "Screen Recording Started" "Saving to $outfile"
ffmpeg -y \
-video_size "$screen_size" \
-framerate 30 \
-f x11grab -i :0.0 \
-f pulse -i "$audio_src" \
-c:v libx264 -preset ultrafast -crf 23 \
-c:a aac -b:a 128k \
"$outfile" >/dev/null 2>&1 &
echo $! > "$pidfile"