Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.