-
Notifications
You must be signed in to change notification settings - Fork 2
/
afterallcopied.sh
29 lines (25 loc) · 945 Bytes
/
afterallcopied.sh
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
#!/usr/bin/bash
# script passed argument of the root directory for currently copied files
# eg. 'sync/20170712_160423'
ARTISTNAME="lowerbackpain" # used for mp3 metadata
# current version requires ffmpeg or on raspberry pi avconv
command -v avconv && CMD=avconv
command -v ffmpeg && CMD=ffmpeg
if [ "$CMD" == "" ]; then
echo "cannot transcode, no ffmpeg or avconv found.";
exit
fi
# CUT SILENCE from end of album's and tape's
# reduces size
for file in `ls $1/album/*.aif $1/tape/*.aif`; do
echo "cut $file silence at end of"
$CMD -y -i $file -af areverse /tmp/temp1.aif
$CMD -y -i /tmp/temp1.aif -af silenceremove=1:0:-96dB /tmp/temp2.aif
$CMD -y -i /tmp/temp2.aif -af areverse $file
rm /tmp/temp1.aif /tmp/temp2.aif
done
# TRANSCODE album's to mp3
for file in `ls $1/album/*.aif`; do
echo "convert $file to mp3"
$CMD -loglevel panic -i $file -metadata artist="$ARTISTNAME" -b:a 320k ${file%.*}.mp3
done