Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple .wav files (numbered from 1) which I want to convert them to .mp3. audacity can do that with opening a file and exporting using it's GUI.

Is there a way that I do this with a bash command so I can do the whole job with a bash loop?

share|improve this question

Assuming you have the codecs installed (libavcodec52 or similar), and ffmpeg, something like this should work:

for i in `ls /my/wav/dir/*.wav`; do ffmpeg -i $i -acodec libmp3lame `basename $i .wav`.mp3; done

I always like to test crazy loops first to make sure the syntax is coming out right:

for i in `ls /my/wav/dir/*.wav`; do echo "ffmpeg -i $i -acodec libmp3lame `basename $i .wav`.mp3"; done
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.