From 10ca25091c3e56ec29d6ba4f6345317e110b3053 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sun, 22 Mar 2020 01:15:56 +0000
Subject: [PATCH] Add some final instructional comments and timezone variable
---
transcode_music.sh | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/transcode_music.sh b/transcode_music.sh
index 2b28bca..00c1c08 100755
--- a/transcode_music.sh
+++ b/transcode_music.sh
@@ -1,5 +1,19 @@
#!/bin/bash
+# Script to transcode music in buld using ffmpeg
+
+bitrate=192
+
+transcode() {
+ if [ "ffprobe $1 2>&1 | grep bitrate | cut -d' ' -f8" > 192000 ]; then
+ echo in $1
+ echo out "trans_music/$(echo ${1%.*} | cut -f1 -d'/' --complement).mp3"
+ ffmpeg -i "$d" -b:a $bitrate "trans_music/$(echo ${1%.*}).mp3"#| cut -f1 -d'/' --complement).mp3"
+ else
+ cp "$d" "trans_music/$(echo $1)" # | cut -f1 -d'/' --complement)"
+ fi
+}
+
shopt -s globstar
rm -r trans_music
@@ -8,11 +22,5 @@
cp -r --attributes-only Music/* trans_music/
find trans_music -type f -delete
for d in **/*.{mp3,flac,mp4,m4a,ogg}; do
- if [ "ffprobe -show_format 2>/dev/null $d | grep bit_rate | cut -d'=' -f2" > 192000 ]; then
- echo in $d
- echo out "trans_music/$(echo ${d%.*} | cut -f2,3,4,5 -d'/').mp3"
- ffmpeg -i "$d" -b:a 192000 "trans_music/$(echo $d | cut -f1 -d'.' | cut -f2,3,4,5 -d'/').mp3"
- else
- cp "$d" "trans_music/$(echo $d | cut -f2,3,4,5 -d'/')"
- fi
+ transcode $d &
done
--
Gitblit v1.10.0