To convert foo.wma to foo.mp3
just run this sequence of commands:
$ mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader foo.wma $ lame -m s -h audiodump.wav -o foo.mp3 $ mp3info -a "Artist name" -t "Song title" -l "Album name" foo.mp3
If you have a bunch of files, there's a good chance that the file names contain embedded spaces, punctuation marks, and other Windows detritus. So you need to be careful when you automate this. Something like the following should work, use find to invoke a script:
$ cat convertor
#!/bin/sh
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$1"
lame -m s -h audiodump.wav -o "`echo $1 | sed 's/wma/mp3/'`"
$ find *.wma -exec ./convertor {} \;
Then go through and label the files with mp3info.
To convert foo.flac to foo.mp3
$ flac -dc foo.flac | lame -h -b 192 /dev/stdin foo.mp3 $ mp3info -a "Artist name" -t "Song title" -l "Album name" foo.mp3
Here's a shell script that will do the conversion,
including extracting the FLAC tags and inserting
them as MP3 tags in the result.
Call it as something like:
/path/to/script foo.flac
and the result will be a new file named foo.mp3
#!/bin/sh
FLAC_FILE=$1
MP3_FILE=`echo ${FLAC_FILE} | sed 's/\.flac/.mp3/'`
metaflac --export-tags-to=/dev/stdout "${FLAC_FILE}" |
sed -e 's/=/="/' -e 's/$/"/' > /tmp/tags-$$
cat /tmp/tags-$$
. /tmp/tags-$$
rm /tmp/tags-$$
flac -dc "${FLAC_FILE}" |
lame -h -b 192 \
--tt "${Title}" \
--tn "${Tracknumber}" \
--ty "${Date}" \
--ta "${Artist}" \
--tl "${Album}" \
--tg "${Genre}" \
--add-id3v2 /dev/stdin "${MP3_FILE}"
Yes, if the creators of the FLAC file got overly imaginative with metacharacters within the tags, or just used strange strings for the "Genre" field, the above won't work precisely as written. Delete the optional tag parameters as needed.
|
||||||||||||
|
||||||||||||