It needs two programs:
lame
mp3info
You can install them using
sudo apt-get install lame mp3info or another package manager of your choice.Save the following code in a file called
reencmp3 and follow the instructions below (don'f forget to make it executable!).#!/bin/bash
# written by oerms@gmx.net
# reencode mp3 with with VBR and defined minimum bitrate
#
# usage: "reencmp3 112" with the mp3s in the current working directory
#
# Encoding with a minimum of 112kbps yields files slightly
# bigger than CBR 128kbps but of much better quality.
#
out="$PWD"\ reenc""
mkdir "$out"
for i in *.mp3; do
lame -h -v -b "$1"\
--tt "`mp3info -p "%t" "$i"`"\
--ta "`mp3info -p "%a" "$i"`"\
--tl "`mp3info -p "%l" "$i"`"\
--ty "`mp3info -p "%y" "$i"`"\
--tc "`mp3info -p "%c" "$i"`"\
--tn "`mp3info -p "%n" "$i"`"\
--tg "`mp3info -p "%g" "$i"`"\
--space-id3v1\
"$i" "$out/$i"
done
The script is to be executed in the directory where all the mp3 are that are to be converted. If for example all your mp3 are in
/foo/bar, you do a cd /foo/bar and then call the script /dir/of/script/reencmp3 112.It then takes all files that end on
*.mp3 and is re-encoding them with variable bitrate and saving them into the directory /foo/bar reenc/.As you can see it takes one parameter, indicating the minimum bitrate used for encoding.
If you want to modify the file the following parameters might be useful to you:
## mp3info parameters
#%a artist [string]
#%c comment [string]
#%g musical genre [string]
#%l album name [string]
#%n track [integer]
#%t track title [string]
#%y year [string]
##lame parameters
#--tt title
#--ta artist
#--tl album
#--ty year
#--tc comment
#--tn track[/total]
#--tg genre
#--space-id3v1
UPDATE:
My cell plays the music quite loud which annoys me (and is not very healthy either). I modified the
lame line with the parameter--scale 0.1
Now it is not as loud as before and everything is fine.
The same parameter can be used to increase the volume, just enter a value >1.
No comments:
Post a Comment
Write me!