-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcap
executable file
·72 lines (63 loc) · 1.08 KB
/
cap
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# set -x
audio_offset=0.45
wait_time=2
args=`getopt o:t: $*`
quality=
app=$(basename $0)
usage() {
echo ""
echo "Usage: $app [-o audio_offset] [-t seconds] output_base"
out="output_base".$(date +%F-%H%M.%S)
echo ""
echo " recoding will be: ${out}.mkv"
echo ""
exit 2
}
if [ $? != 0 ]
then
usage
fi
set -- $args
for i; do
case "$i"
in
-o)
echo Setting audio offset to "'"$2"'"; audio_offset="$2"; shift;
shift;;
-t)
echo Setting wait time to "'"$2"'"; wait_time="$2"; shift;
shift;;
--)
shift; break;;
esac
done
if [ $# = 0 ]; then
usage
fi
out="$@".$(date +%F-%H%M.%S)
SwitchAudioSource -s 'Soundflower (2ch)'
cat <<EOF
##
## Hit ctrl-C to stop recording "$out.mkv".
## Waiting for $wait_time seconds...
##
EOF
sleep $wait_time
ffmpeg \
-hide_banner \
-loglevel info \
-thread_queue_size 512 \
-f avfoundation \
-i "1" \
-thread_queue_size 512 \
-f avfoundation \
-ac 2 \
-itsoffset $audio_offset \
-i ":2" \
-c:a aac \
-c:v libx264 \
-crf 0 \
-preset ultrafast \
-threads 0 "$out".mkv
SwitchAudioSource -s 'External Headphones'