Help - Search - Members - Calendar
Full Version: encoding with LAME under Linux
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
Red_erik
What is the easiest way of encoding a directory full of *.wav files using LAME, without any other programs?
kjoonlee
cd wavdir
for I in *.wav ; do lame $I $I.mp3 ; done
Red_erik
QUOTE(kjoonlee @ Nov 2 2004, 07:33 PM)
cd wavdir
for I in *.wav ; do lame $I  $I.mp3 ; done
*


I typed it in as:
CODE
for I in *.wav; do 'lame --preset standard' $l $l.mp3; done
and got:

-bash: lame --preset standard: command not found
-bash: lame --preset standard: command not found
-bash: lame --preset standard: command not found
-bash: lame --preset standard: command not found
<etc.>
kjoonlee
edit: for A in *.wav ; do lame --preset standard $A $A.mp3 ; done

Please note how I didn't use any single quotes. Notice that A and $A and $A all match.

If you don't have lame installed, it's fairly simple to compile and install it from source.
DonP
QUOTE(Red_erik @ Nov 3 2004, 04:17 AM)

I typed it in as:
CODE
for I in *.wav; do 'lame --preset standard' $l $l.mp3; done
  and got:
    ...
-bash: lame --preset standard: command not found
<etc.>
*


Well, yeah, if you don't have lame (or it isn't in your path) it won't work.

Get it here:

http://www.rarewares.org/mp3.html

The linux executable is a ways down, just search for it.
kjoonlee
It's possible that even though lame is actually installed, it could be being called incorrectly. Run it for yourself with the quotes and you'll see right away.
Red_erik
QUOTE(kjoonlee @ Nov 3 2004, 04:20 PM)
edit: for A in *.wav ; do lame --preset standard $A $A.mp3 ; done
*


okay
QUOTE(kjoonlee @ Nov 3 2004, 04:20 PM)
Please note how I didn't use any single quotes. Notice that A and $A and $A all match.
*


I guess I just wasn't paying attention; sorry smile.gif

QUOTE(kjoonlee @ Nov 3 2004, 04:20 PM)
If you don't have lame installed, it's fairly simple to compile and install it from source.
*


I do have it installed, compiled by myself

now when I run your command, I just get a
CODE
LAME version 3.96.1 (http://lame.sourceforge.net/)

usage: lame [options] <infile> [outfile]

   <infile> and/or <outfile> can be "-", which means stdin/stdout.

Try:
    "lame --help"           for general usage information
or:
    "lame --preset help"    for information on suggested predefined settings
or:
    "lame --longhelp"
 or "lame -?"              for a complete options list

screen (printout?) for every file.
Could it be because the filenames have spaces in them?
ak
Sure. Adding quotes to filenames is obligatory smile.gif
Btw, if you use bash s/t like this will output .mp3 instead of .wav.mp3
> for i in *.wav; do lame --preset standard "$i" "${i/%wav/mp3}"; done
kjoonlee
Ooh wow. I had forgotten all about spaces, and I never knew you could do that with bash.

It works like a charm for me. Thanks, ak. smile.gif
Red_erik
QUOTE(kjoonlee @ Nov 3 2004, 08:00 PM)
It works like a charm for me. Thanks, ak. smile.gif
*


same here!
thanks a lot! wink.gif
ak
My pleasure smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.