-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake-podcast
55 lines (53 loc) · 1.29 KB
/
make-podcast
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
#!/bin/bash
TIME=$(date +%Y-%m-%d_%H-%M-%S)
case "$1" in
--trim)
if [[ "$2" -ne "0" || -z "$2" ]]; then
echo "Missing or incorrect parameters"
exit
fi
echo "file: $2, start: $3, end: $4"
# Trim the file, keeping only start to end times
ffmpeg -y \
-i "$2" \
-ss "$3" \
-to "$4" \
-acodec pcm_s16le \
audio_trimmed_$TIME.wav
exit
;;
--record)
echo "Recording from Pulseaudio, processing in FFMPEG..."
# Recording raw audio data with FFMPEG
ffmpeg -y \
-f pulse \
-ac 1 \
-ar 48000 \
-i default \
-filter_complex "compand=attacks=0:points=-60/-40|-30/-15|-15/-10|-5/-8|0/-6" \
-acodec pcm_s16le \
audio_recorded_$TIME.wav
exit
;;
--convert)
if [[ -z "$2" ]]; then
echo "Missing or incorrect parameters"
exit
fi
echo "file: $2, convert to mp3"
# Trim the file, keeping only start to end times
ffmpeg -y \
-i "$2" \
-acodec libmp3lame \
-b:a 128k \
audio_converted_$TIME.mp3
exit
;;
*)
echo "usage: make-podcast < --record | --trim | --convert| --help > < audiofile > < start time hh:mm:ss > < end time hh:mm:ss >"
echo "--record: compands and saves audio in wav format"
echo "--trim: keeps audio between start and end times in wav format"
echo "--convert: converts audio from wav to mp3"
exit
;;
esac