summaryrefslogtreecommitdiff
path: root/dot/local/bin/record
blob: 646eceed84653eb3375aa43ee97cf59e3ca0dc58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
output=mic-recording.$(date -Iseconds).mp3
latest=mic-recording.latest.mp3
ffmpeg -loglevel error -f alsa -ac 2 -i default -acodec libmp3lame -ab 192k ./"$output" &
pid=$!

if [ "$DISPLAY" ]; then
	xmessage 'click OK to stop recording'
else
	echo 'press ENTER to stop recording'
	read line
fi

kill $pid

if [ -L "$latest" -o ! -e "$latest" ]; then
	ln -sf "$output" "$latest"
fi