summaryrefslogtreecommitdiff
path: root/dot/local/bin/screeny
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local/bin/screeny')
-rwxr-xr-xdot/local/bin/screeny31
1 files changed, 31 insertions, 0 deletions
diff --git a/dot/local/bin/screeny b/dot/local/bin/screeny
new file mode 100755
index 0000000..8ecf2d0
--- /dev/null
+++ b/dot/local/bin/screeny
@@ -0,0 +1,31 @@
1#!/bin/bash
2die() { printf '%s: Error: %s\n' "$0" "$*" >&2; exit 1; }
3[ "$DISPLAY" ] || die 'no $DISPLAY set. Try launching from a new xterm.'
4
5AUDIO_DEVICE=pulse
6
7NOW=$(date -Iseconds)
8
9OUTPUT=screen-capture.${NOW//[:T]/.}.avi
10OUTPUT_LINK=screen-capture.latest.avi
11
12# ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
13
14record()
15{
16 local timeout="${MAX_RECORDING_TIME+-t $MAX_RECORDING_TIME}"
17 ffmpeg -hide_banner -loglevel error -stats \
18 $timeout -f x11grab -framerate 25 -video_size 1280x800 -i "$DISPLAY" \
19 $timeout -f "$AUDIO_DEVICE" -i default \
20 -c:a mp3 \
21 -c:v libxvid -qscale:v 3 \
22 "$1"
23}
24
25silently() { "$@" >/dev/null 2>&1; }
26
27silently amixer-enable-mic
28banish
29record "$OUTPUT"
30
31[ -h "$OUTPUT_LINK" -o ! -e "$OUTPUT_LINK" ] && ln -sf "$OUTPUT" "$OUTPUT_LINK"