6

I have a ton of music on my computer, but unfortunately it's in m4a, and steam only takes mp3.

Is there a program or a terminal command that will convert an entire folder?

Zanna
  • 72,312

1 Answers1

13

This was fairly simple. First you'll need ffmpeg installed.

Then there's this simple terminal command you can use to convert all the audio files to MP3:

for f in *.flac , *.m4a , *.ogg ; do ffmpeg -i "$f" -ab 320k "${f%.m4a}.mp3"; done

Breakdown:

  • for f in *.flac , *.m4a , *.ogg ;: For every audio file of these types,
  • do ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3";: Convert that file to MP3, get the next file.
  • If you want to change the bitrate, simply change the 320k in kbps.
  • You can change the filetypes it looks for simply with that comma-separated list of *.flac , *.m4a , *.ogg to whatever files ffmpeg can decode.
  • You can change the output name to whatever you want, "${f%.m4a}.mp3" could be "${f%}.mp3" or "${f%.audio}.mp3", f% represents the original filename.
Robobenklein
  • 1,496