Contents |
MPEG files comes in different flavours. We shall focus on MPEG audio.
Moving Picture Experts Group (MPEG) is a family of standards for coding audio-visual information in a digital compressed format. The MPEG family of standards includes:
MPEG-3 doesn't exist, it has been merged into MPEG-2.
MPEG Layers are coding schemes. There are 3:
with increasing efficiency and complexity. Furthermore, each layer implements the previous layers.
So, MP3 files are MPEG-1 Part 3 Layer 3 files.
And now the plot thickens: the MPEG-2 standard also supports MP3 audio, but extends the number of possible bit- and samplerates. And just add salt to the wound, Fraunhofer Institut Integrierte Schaltungen has implemented a non-ISO variant, referred to as MPEG-2.5, with even more possible variations. The possible bit- and samplerates are listed here (output from lame --longhelp|tail):
* MPEG-1 layer III sample frequencies (kHz): 32 48 44.1 bitrates (kbps): 32 40 48 56 64 80 96 112 128 160 192 224 256 320 * MPEG-2 layer III sample frequencies (kHz): 16 24 22.05 bitrates (kbps): 8 16 24 32 40 48 56 64 80 96 112 128 144 160 * MPEG-2.5 layer III sample frequencies (kHz): 8 12 11.025 bitrates (kbps): 8 16 24 32 40 48 56 64 80 96 112 128 144 160
First, I used iTunes for encoding to MP3. It could encode to 192 kbps, which was what I wanted. The resulting audio was near-perfect for listening on my iPod. But iTunes is too restrictive: you cannot copy music from your iPod to the computer with it.
So, I wanted another solution: LAME.
Lame has a nice Windows frontend: winLAME.
lame is the MPEG encoder, id3v2 is an ID3 tag editing tool.
# emerge lame id3v2
lame Usage Convert a flac file into a Constant Bit Rate (CBR) 192kbps MP3
# flac -dc 04-Gravity_rearrangin.flac | lame -b192 - >"Gravity Rearrangin.mp3"
Convert a flac file into a Variable Bit Rate (VBR) file with good quality
# flac -dc 04-Gravity_rearrangin.flac | lame --preset extreme - >"Gravity Rearrangin.mp3"
Convert all the flac files in a directory into iPod-friendly format MP3 files in the current directory. The iPod cannot read VBR MP3s. Set ID3 tags.
path=BryanFerry/Mamouna/
outputpath="../MP3/Bryan Ferry/Mamouna/"
for f in `find $path -name "*.flac" -maxdepth 1 -printf "%f\n"`;
do
tracknumber=`echo $f|egrep -o "^[0-9]+"`
filename=`echo $f|sed -r -e "s/\.flac$/\.mp3/g" -e "s/_/ /g" -e "s/^[0-9]+-//g"`
trackname=`echo $f|sed -r -e "s/\.flac$//g" -e "s/_/ /g" -e "s/^[0-9]+-//g"`
echo "==== trackname: '$trackname' tracknumber: '$tracknumber' output: '$outputpath$filename'"
flac -dc $path$f | \
lame -b192 --ta "Bryan Ferry" --tl "Mamouna" --ty "1994" --tg "Rock" \
--tt "$trackname" --tn $tracknumber - >"$outputpath$filename"
done
Or use the evil one-liner from hell:
$ find -regex ".*\.flac$" -printf "%P\n"| awk '{ new = gensub(/flac/, "mp3", "g", $0);
printf("flac -dc \\\"%s\\\" | lame -b192 - \\\"%s\\\"\n", $0, new); }'| xargs -i bash -c "{}"
$ find -regex ".*\.flac$" -printf "%P\n" | <- find all .flac files
awk '{
new = gensub(/flac/, "mp3", "g", $0); <- create a .mp3 filename
printf("flac -dc \\\"%s\\\" | lame -b192 - \\\"%s\\\"\n", $0, new); <- create command
}' | xargs -i bash -c "{}"
The ID3v1 tags are horrible in every way. They are included as the last 128 bytes of a MP3 file, making the parsing of them slow. All the data of the tags are limited to 30 characters. And we haven't even discussed the worst of it yet.
So - use ID3v2 instead. Se my article on Encoding for example usage.
Some genius named Eric Kemp had a bright idea:
And then he creates a list of genres, including many usable ones, such as Rock, Pop, Classical, enabling us to broadly define the area of music a particular track belongs to. That's fine. But a lot of numbers were left unused. What does Eric Kemp, the omniscient music scientist, do? The pinhead adds obscure genres like:
I believe some of these genres existed for about 17 minutes one day in 1993, and I'm pretty sure "Psychadelic" and "Fast Fusion" never existed at all. Furthermore, I won't think "Christian Rap" ever will be a big hit... But who knows?
Of course, he had never heard of genres such as:
(if you can't tell, I'm being sarcastic :)
To complete the travesty, WinAmp (an otherwise good program) extended the standard with the above mentioned genres, but also added new genres, like:
... and, of course, not to forget the Christian Rap blunder of the original format, a new genre called "Christian Gangsta" is added... Great stuff!