mirror of https://github.com/Chizi123/Scripts.git

Joel Grunbaum
2020-09-21 afe40b2bf69d3b1dd5b2368968008e8e321727a7
commit | author | age
4ce3ae 1 #!/bin/bash
JG 2
828250 3 # Script to transcode music in buld using ffmpeg
JG 4
64e605 5 bitrate=192
JG 6
7 transcode() {
8     if [ "ffprobe $1 2>&1 | grep bitrate | cut -d' ' -f8" > 192000 ]; then
9         echo in $1
10         echo out "trans_music/$(echo ${1%.*} | cut -f1 -d'/' --complement).mp3"
11         ffmpeg -i "$d" -b:a $bitrate "trans_music/$(echo ${1%.*}).mp3"#| cut -f1 -d'/' --complement).mp3"
12     else
13         cp "$d" "trans_music/$(echo $1)" # | cut -f1 -d'/' --complement)"
14     fi
15 }
828250 16
4ce3ae 17 shopt -s globstar
JG 18
19 rm -r trans_music
20 mkdir trans_music
21
22 cp -r --attributes-only Music/* trans_music/
23 find trans_music -type f -delete
24 for d in **/*.{mp3,flac,mp4,m4a,ogg}; do
64e605 25     transcode $d &
4ce3ae 26 done