#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Location
    Mumbai, India
    Posts
    63
    Rep Power
    8

    LAME .wav to.mp3 batch conversion


    I am using lame to do .wav to .mp3 conversion
    I have to do this -->
    lame -V input.wav output.mp3
    But i have 1000 .wav files and all i need to do is using lame convert them all into .mp3 automatically by naming the mp3 the same.

    How do I do it using command line or maybe by writing a script
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,396
    Rep Power
    1871
    Well from a command line...
    Code:
    for i in *.wav ; do
      echo $i
      b=`basename $i .wav`
      lame -V $i $b.mp3 
    done
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Location
    Mumbai, India
    Posts
    63
    Rep Power
    8
    Originally Posted by salem
    Well from a command line...
    Code:
    for i in *.wav ; do
      echo $i
      b=`basename $i .wav`
      lame -V $i $b.mp3 
    done
    thank you it worked. Simple and great!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    A little modification for filenames with SPACES


    If your filenames have spaces then you have to make a little modification:

    for i in *.wav ; do
    echo $i
    b=`basename "$i" .wav`
    echo $b
    lame --preset insane "$i" "$b.mp3"
    done

    The --preset insame makes lame convert in higher quality

IMN logo majestic logo threadwatch logo seochat tools logo