diff options
author | Andrew Cady <d@jerkface.net> | 2016-12-26 14:20:58 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-12-26 14:30:48 -0500 |
commit | 4b1eb9d36e6ed185ef920e1911cbeedeac2136fb (patch) | |
tree | 370ec0254f928168bf2c617b9e98ccfa50317d50 /dot/local | |
parent | bbc6051d367cc8ec0b3e06dbdf9b6435e4136644 (diff) |
new command
Diffstat (limited to 'dot/local')
-rwxr-xr-x | dot/local/bin/selfie | 31 |
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 | |||
3 | AUDIO_DEVICE=pulse | ||
4 | VIDEO_DEVICE=/dev/video0 | ||
5 | |||
6 | MAX_RECORDING_TIME=00:05:00 | ||
7 | |||
8 | NOW=$(date -Iseconds) | ||
9 | |||
10 | OUTPUT=recording.${NOW//[:T]/.}.avi | ||
11 | OUTPUT_LINK=recording.latest.avi | ||
12 | |||
13 | record() | ||
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 | |||
25 | silently() { "$@" >/dev/null 2>&1; } | ||
26 | |||
27 | silently amixer-enable-mic | ||
28 | banish | ||
29 | record "$OUTPUT" | ||
30 | |||
31 | [ ! -f "$OUTPUT_LINK" ] && ln -sf "$OUTPUT" "$OUTPUT_LINK" | ||