prevent lame from resampling
This commit is contained in:
parent
8f9e8f73bf
commit
121e586b08
48
atom
48
atom
@ -23,6 +23,7 @@ declare -A \
|
|||||||
destinationpath \
|
destinationpath \
|
||||||
destinationquality \
|
destinationquality \
|
||||||
destinationrename \
|
destinationrename \
|
||||||
|
destinationnoresample \
|
||||||
destinationrenamepath \
|
destinationrenamepath \
|
||||||
destinationskipmime \
|
destinationskipmime \
|
||||||
|| {
|
|| {
|
||||||
@ -218,6 +219,21 @@ getConfigDestination() {
|
|||||||
unset expr
|
unset expr
|
||||||
destinationfrequency["$destination"]=$value
|
destinationfrequency["$destination"]=$value
|
||||||
;;
|
;;
|
||||||
|
'noresample')
|
||||||
|
case $value in
|
||||||
|
'true'|'on'|'yes')
|
||||||
|
destinationnoresample["$destination"]=1
|
||||||
|
;;
|
||||||
|
'false'|'off'|'no')
|
||||||
|
destinationnoresample["$destination"]=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "noresample takes values:" \
|
||||||
|
"'yes' ,'true' ,'on', 'no', 'false',"\
|
||||||
|
"'off'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
'rename')
|
'rename')
|
||||||
case "$value" in
|
case "$value" in
|
||||||
*/*)
|
*/*)
|
||||||
@ -1076,6 +1092,38 @@ encodeFile::mp3() {
|
|||||||
[ -n "$title" ] && lameopts+=" --tt \"$title\""
|
[ -n "$title" ] && lameopts+=" --tt \"$title\""
|
||||||
[ -n "$track" ] && lameopts+=" --tn \"$track\""
|
[ -n "$track" ] && lameopts+=" --tn \"$track\""
|
||||||
[ -n "$year" ] && lameopts+=" --ty \"$year\""
|
[ -n "$year" ] && lameopts+=" --ty \"$year\""
|
||||||
|
if (( ${destinationnoresample[$destination]:-0} == 1 ))
|
||||||
|
then
|
||||||
|
# If 'rate' is not one of these value, it cannot be encoded to
|
||||||
|
# MP3, in which case we'd be better of letting lame decide which
|
||||||
|
# rate to use.
|
||||||
|
if [ -n "${destinationfrequency["$destination"]}" ]
|
||||||
|
then
|
||||||
|
case ${destinationfrequency["$destination"]} in
|
||||||
|
48000) lameopts+=" --resample 48" ;;
|
||||||
|
44100) lameopts+=" --resample 44.1" ;;
|
||||||
|
32000) lameopts+=" --resample 32" ;;
|
||||||
|
24000) lameopts+=" --resample 24" ;;
|
||||||
|
22050) lameopts+=" --resample 22.05" ;;
|
||||||
|
16000) lameopts+=" --resample 16" ;;
|
||||||
|
12000) lameopts+=" --resample 12" ;;
|
||||||
|
11025) lameopts+=" --resample 11.025" ;;
|
||||||
|
8000) lameopts+=" --resample 8" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case $rate in
|
||||||
|
48000) lameopts+=" --resample 48" ;;
|
||||||
|
44100) lameopts+=" --resample 44.1" ;;
|
||||||
|
32000) lameopts+=" --resample 32" ;;
|
||||||
|
24000) lameopts+=" --resample 24" ;;
|
||||||
|
22050) lameopts+=" --resample 22.05" ;;
|
||||||
|
16000) lameopts+=" --resample 16" ;;
|
||||||
|
12000) lameopts+=" --resample 12" ;;
|
||||||
|
11025) lameopts+=" --resample 11.025" ;;
|
||||||
|
8000) lameopts+=" --resample 8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
encodetaskid=$(
|
encodetaskid=$(
|
||||||
Insert tasks <<-EOInsert
|
Insert tasks <<-EOInsert
|
||||||
key ${fileid}lame$destination
|
key ${fileid}lame$destination
|
||||||
|
|||||||
@ -92,3 +92,7 @@ Sections:
|
|||||||
MP3 parameters:
|
MP3 parameters:
|
||||||
* bitrate <bitrate>: Set ABR to <bitrate>. Again, if you want CBR or any
|
* bitrate <bitrate>: Set ABR to <bitrate>. Again, if you want CBR or any
|
||||||
other mode supported by lame, please fork and file a pull request.
|
other mode supported by lame, please fork and file a pull request.
|
||||||
|
* noresample <yes>/<no>: LAME may decide to encode your file to a lower
|
||||||
|
sampling-rate if you use a low bitrate. Setting this to yes will
|
||||||
|
append --resample <original file's rate>, preventing any resampling from
|
||||||
|
happening.
|
||||||
|
|||||||
@ -25,14 +25,15 @@ copy_mime-type image/*
|
|||||||
copy_mime-type text/*
|
copy_mime-type text/*
|
||||||
|
|
||||||
[MP3]
|
[MP3]
|
||||||
path /mnt/Musique-mp3.test
|
path /mnt/Musique-mp3.test
|
||||||
format mp3
|
format mp3
|
||||||
bitrate 96
|
bitrate 96
|
||||||
|
noresample yes
|
||||||
normalize yes
|
normalize yes
|
||||||
higher-than 128
|
higher-than 128
|
||||||
|
|
||||||
# rename file, path unchanged
|
# rename file, path unchanged
|
||||||
rename %{track}--%{artist}-%{title}
|
rename %{track}--%{artist}-%{title}
|
||||||
# change the whole filepath
|
# change the whole filepath
|
||||||
#rename %{genre}/%{albumartist}/%{year}-%{album}/%{track}--%{artist}-%{title}
|
#rename %{genre}/%{albumartist}/%{year}-%{album}/%{track}--%{artist}-%{title}
|
||||||
skip_mime-type image/*
|
skip_mime-type image/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user