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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI 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?
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