Ubuntu – How to convert .aif audio files to mp3

aifconvertsoundsox

I have audio files with .aif extensions (AIFF/Amiga/Mac audio). How to play them and, more important: how to convert them to mp3 or other more common audio format?


update: trying to run a command found here, namely for i in *.aif; do sox "$i" "$i.wav"; done, and having sox already installed, i get an error like

sox FAIL formats: can't open input file 'filename': Unsupported AIFC
compression type `ima4'


exiftool provides info such as:

File Size                       : 41 MB
File Modification Date/Time     : 2013:04:23 15:54:02+02:00
File Permissions                : rw-r--r--
File Type                       : AIFC
MIME Type                       : audio/x-aiff
Format Version Time             : 1990:05:23 14:40:00
Num Channels                    : 1
Num Sample Frames               : 1257382
Sample Size                     : 0
Sample Rate                     : 16000
Compression Type                : Unknown (ima4)

for some reason sudo apt-get install ffmpeg libavcodec-unstripped-52 would not work (Unable to locate package – but Multiverse is enabled)

Best Answer

Following Toon's Unix Recipes, for example (and the above examples):

sudo apt-get install ffmpeg
ffmpeg -i track1.aiff -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 track1.mp3

(Older versions of Ubuntu can use avconv instead of ffmpeg.)