How to convert AIFF to MP3 on command line

If you've ever made a really big track (big as in file size), and you have a website where you'd like to upload it, but the website has a size limit, you'll have to re-encode you track into a different format which is smaller. Of course, you could just use an online converter but most of them also have a size limit and you would literally just waste your time uploading.

Well, you could install Audacity or some other DAW tool to do this, but the most easy way is doing it on the command line.

To do this, you'll just need to install ffmpeg. The command to do this may vary depending on your OS, I'll just list macOS and Debian/Ubuntu here.

  • Debian/Ubuntu: $ sudo apt install ffmpeg libavcodec-unstripped-52
  • macOS (Homebrew): brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc (The parameters at the end will install additional formats)

After this, it's time to start the conversion:

$ ffmpeg -i myinput.aif -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 myoutput.mp3

The -ab parameter sets the sample rate. I chose the maximum value for MP3 which is 320kbit/s. If you set a smaller value here, your file will come out smaller but more lossy.