diff options
Diffstat (limited to 'abs/core/linhes-scripts/myth2mp3')
-rwxr-xr-x | abs/core/linhes-scripts/myth2mp3 | 27 |
1 files changed, 20 insertions, 7 deletions
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 |