Monday, August 18, 2008, 17:19
Posted by Administrator
So you have your nice lossless audio all compressed into FLAC. How do you quickly convert them to high quality mp3's to stick on your ipod or some other mp3 player? I've written a script below that will do it for you in one easy step. It takes a few steps to set it up first, but once it's done you'll only ever need to type one command.Posted by Administrator
First, you'll need to install FLAC and lame 3.97
sudo aptitude install flac
sudo aptitude install lame
As of this writing the Ubuntu repositories still has lame 3.97 as the current. I've configured my script to take advantage of the new vbr algorithm with the --vbr-new switch. When the repositories are updated or you compile lame 3.98 yourself, edit the script to comment in the v3.98 line and comment out the v3.97 line
Now you'll need to get my script. Change to the /bin folder like so:
cd /bin
now type this:
wget www.mellowd.co.uk/scripts/encode
Now you'll need to make that file an excecutable like so:
chmod +x encode
Now all you need to do is go into the folder that has your flac files and type:
encode
The script will decode all the .flac files to .wav in a new subfolder, stripping the .wav suffix. It will then run lame to create mp3's in a new folder in the original folder using the -q0 setting which is the nest VBR setting available with lame. It will then delete all the .wav files and subfolder and finally it will add the .mp3 suffix to all your new mp3's.
When it's complete you'll have an mp3 folder in your original folder, full of high quality mp3's
This is the contents of the current script itself as of today:
# Encode
# v0.2 18.08.08 - Second draft, changed the default to lame 3.97 as this is what's in the Ubuntu repositories
# v0.1 17.08.08 - First created
# Darren O'Connor <mellow.drifter@gmail.com>
# This script, when run in a folder full of FLAC files, will create high quality VBR mp3's for use in mp3 players.
# This version uses lame 3.98 and 3.97. Please edit out the appropriate line below (Don't leave them both in!)
#!/bin/bash
mkdir wav/
flac -d *.flac
mv *.wav wav/
cd wav/
for f in *.wav; do mv "$f" "${f%.wav}";done
mkdir ../mp3/
# If you use lame 3.98 then comment IN the next line and comment out the following line
# find -maxdepth 1 -type f -name '*' -exec lame -V0 -q0 '{}' -o '../mp3/{}' \;
# If you use lame 3.97 then comment IN the next line and comment OUT the previous line
find -maxdepth 1 -type f -name '*' -exec lame --vbr-new -V0 -q0 '{}' -o '../mp3/{}' \;
cd ../mp3/
for FILE in *; do mv "$FILE" "$FILE.mp3"; done
cd ../
rm -r wav/



( 0 / 0 )

Calendar



