summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core/linhes-scripts/PKGBUILD6
-rwxr-xr-xabs/core/linhes-scripts/myth2mp327
2 files changed, 23 insertions, 10 deletions
diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD
index 8fabce8..6bc7d27 100644
--- a/abs/core/linhes-scripts/PKGBUILD
+++ b/abs/core/linhes-scripts/PKGBUILD
@@ -3,11 +3,11 @@
pkgname=linhes-scripts
pkgver=7
-pkgrel=35
+pkgrel=36
pkgdesc="Various scripts that help to make LinHES, LinHES."
arch=('i686' 'x86_64')
license=('GPL2')
-depends=('xosd' 'cpulimit' 'screen' 'mencoder' 'tablet-encode' 'mplayer')
+depends=('xosd' 'cpulimit' 'screen' 'mencoder' 'tablet-encode' 'mplayer' 'normalize')
url="http://linhes.org/"
install="linhes-scripts.install"
source=(
@@ -70,7 +70,7 @@ md5sums=('f56985b2d602e11dc1e10d3e7848b2a5'
'1274bad3fb7296f00acd2d44804bad14'
'47225fa9b6c953d56f6ede84d921a300'
'6b6e7d34a4bda6d608d150039adefd07'
- '4be408c11fc888b703c35062d02c6212'
+ '06da54695f4abd5234b6533df01b50f0'
'18263972b6326e140bbef0bb7dfa2da9'
'410795ef9039e4c6c0484e706ecfd567'
'0750d7c65109d12aa536f312a38410d1'
diff --git a/abs/core/linhes-scripts/myth2mp3 b/abs/core/linhes-scripts/myth2mp3
index 504322e..9b13ee1 100755
--- a/abs/core/linhes-scripts/myth2mp3
+++ b/abs/core/linhes-scripts/myth2mp3
@@ -1,6 +1,6 @@
#!/bin/sh
# convert recordings to as mp3 audio only
-# version 1.0
+# version 1.1
# usage:
# first parameter must be %DIR%/%FILE% of the recording
@@ -20,7 +20,7 @@ OUT_DIR=/myth/music
# create temp filename so multiple instances won't conflict
TMPNAME=toMP3-$$
-TMPFILE=/myth/tmp/$TMPNAME.mp3
+TMPFILE=/myth/tmp/$TMPNAME
TMPCUTFILE=/myth/tmp/$TMPNAME.mpg
FFINPUTFILE=$1
TITLE=`echo $2 | sed 's/\//_/g'`
@@ -45,9 +45,21 @@ if [ $USECUTLIST = Y ];then
fi
fi
-# run ffmpeg to do conversion
-echo "Encoding..." >> $LOGFILE
-/usr/bin/nice -n19 /usr/bin/ffmpeg -i "$FFINPUTFILE" -vn -acodec libmp3lame -ab $BITRATE -ar 44100 -ac 2 -vol 2048 "$TMPFILE"
+# run ffmpeg to do conversion to wav
+echo "Encoding to intermediate wav..." >> $LOGFILE
+/usr/bin/nice -n19 /usr/bin/ffmpeg -i "$FFINPUTFILE" -vn -acodec pcm_s16le -ar 44100 -ac 2 "$TMPFILE.wav"
+ERROR=$?
+
+# Normalize the intermediate wav
+echo "Normalizing intermediate wav..." >> $LOGFILE
+/usr/bin/normalize -q --peak "$TMPFILE.wav"
+ERROR=$?
+
+FFINPUTFILE=$TMPFILE.wav
+
+# Fianl encode of normalized wav to mp3
+echo "Encoding to normalized wav to mp3..." >> $LOGFILE
+/usr/bin/nice -n19 /usr/bin/ffmpeg -i "$FFINPUTFILE" -vn -acodec libmp3lame -ab $BITRATE -ar 44100 -ac 2 "$TMPFILE.mp3"
ERROR=$?
# make output filename unique
@@ -60,7 +72,7 @@ do
done
# move temp file to output location
-chown mythtv "$TMPFILE" && mv "$TMPFILE" "$OUTPUTFILE"
+chown mythtv "$TMPFILE.mp3" && mv "$TMPFILE.mp3" "$OUTPUTFILE"
# stop timer
aftertime="$(date +%s)"
@@ -78,6 +90,7 @@ else
fi
# clean up left over files
-unlink $TMPFILE 2> /dev/null
+unlink $TMPFILE.mp3 2> /dev/null
+unlink $TMPFILE.wav 2> /dev/null
unlink $TMPCUTFILE 2> /dev/null
unlink $TMPCUTFILE.map 2> /dev/null