summaryrefslogtreecommitdiff
path: root/dot/local
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-12-26 14:20:58 -0500
committerAndrew Cady <d@jerkface.net>2016-12-26 14:30:48 -0500
commit4b1eb9d36e6ed185ef920e1911cbeedeac2136fb (patch)
tree370ec0254f928168bf2c617b9e98ccfa50317d50 /dot/local
parentbbc6051d367cc8ec0b3e06dbdf9b6435e4136644 (diff)
new command
Diffstat (limited to 'dot/local')
-rwxr-xr-xdot/local/bin/selfie31
1 files changed, 31 insertions, 0 deletions
diff --git a/dot/local/bin/selfie b/dot/local/bin/selfie
new file mode 100755
index 0000000..55d6adf
--- /dev/null
+++ b/dot/local/bin/selfie
@@ -0,0 +1,31 @@
1#!/bin/bash
2
3AUDIO_DEVICE=pulse
4VIDEO_DEVICE=/dev/video0
5
6MAX_RECORDING_TIME=00:05:00
7
8NOW=$(date -Iseconds)
9
10OUTPUT=recording.${NOW//[:T]/.}.avi
11OUTPUT_LINK=recording.latest.avi
12
13record()
14{
15 local timeout="${MAX_RECORDING_TIME+-t $MAX_RECORDING_TIME}"
16 ffmpeg -hide_banner -loglevel error -stats \
17 $timeout -f video4linux2 -i "$VIDEO_DEVICE" \
18 $timeout -f "$AUDIO_DEVICE" -i default \
19 -f xv win \
20 -c:a mp3 \
21 -c:v libxvid \
22 "$1"
23}
24
25silently() { "$@" >/dev/null 2>&1; }
26
27silently amixer-enable-mic
28banish
29record "$OUTPUT"
30
31[ ! -f "$OUTPUT_LINK" ] && ln -sf "$OUTPUT" "$OUTPUT_LINK"