commit | author | age
|
4ce3ae
|
1 |
#!/bin/bash |
JG |
2 |
|
|
3 |
shopt -s globstar |
|
4 |
|
|
5 |
rm -r trans_music |
|
6 |
mkdir trans_music |
|
7 |
|
|
8 |
cp -r --attributes-only Music/* trans_music/ |
|
9 |
find trans_music -type f -delete |
|
10 |
for d in **/*.{mp3,flac,mp4,m4a,ogg}; do |
|
11 |
if [ "ffprobe -show_format 2>/dev/null $d | grep bit_rate | cut -d'=' -f2" > 192000 ]; then |
|
12 |
echo in $d |
|
13 |
echo out "trans_music/$(echo ${d%.*} | cut -f2,3,4,5 -d'/').mp3" |
|
14 |
ffmpeg -i "$d" -b:a 192000 "trans_music/$(echo $d | cut -f1 -d'.' | cut -f2,3,4,5 -d'/').mp3" |
|
15 |
else |
|
16 |
cp "$d" "trans_music/$(echo $d | cut -f2,3,4,5 -d'/')" |
|
17 |
fi |
|
18 |
done |