18

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)

andrew.46
  • 38,003
  • 27
  • 156
  • 232
  • 2
    Have you seen e.g." How to play AIFF (AIF) files in Ubuntu" http://ubuntuforums.org/showthread.php?t=1000116 and "Convert Aiff to MP3 with ffmpeg on ubuntu" http://turanct.wordpress.com/2010/04/03/convert-aiff-to-mp3-with-ffmpeg-on-ubuntu/ –  Apr 27 '13 at 10:53
  • 1
    sudo apt-get install ffmpeg libavcodec-unstripped-52 – Qasim Apr 27 '13 at 11:24
  • 1
    ffmpeg -i inputfile.aif -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 outputfile.mp3 – Qasim Apr 27 '13 at 11:24
  • http://www.linuxquestions.org/questions/linux-software-2/convert-aif-mp3-525455/ check this link – Qasim Apr 27 '13 at 11:25
  • @XxxXxx - are you sure libavcodec-unstripped-52 is still around? i am in Quantal, multiverse repo is enabled and there is no libavcodec-unstripped-52 to be found. but there is a libavcodec-extra-53 –  Apr 27 '13 at 15:06
  • 1
    i dont know ....that is why i have pasted as an comment not an answer... i thought may be this will help you... – Qasim Apr 27 '13 at 15:09
  • @XxxXxx - indeed it did. here and here –  Apr 27 '13 at 15:14

4 Answers4

16

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.)

8

Finding this solution here (also recommended in comments), for some reason sudo apt-get install ffmpeg libavcodec-unstripped-52 would not work (Unable to locate package - but Multiverse is enabled).

But in Synaptic I have seen that I had libavcodec53 installed, but not libavcodec-extra-53. Installing the later has uninstalled the former, and then the command ffmpeg -i inputfile.aif -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 outputfile.mp3 worked.

So,

~$ sudo apt-get install libavcodec-extra-53
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libavutil-extra-51 libdirac-encoder0 libopencore-amrnb0 libopencore-amrwb0
  libopenjpeg2 libvo-aacenc0 libvo-amrwbenc0 libx264-123
The following packages will be REMOVED:
  libavcodec53 libavutil51
The following NEW packages will be installed:
  libavcodec-extra-53 libavutil-extra-51 libdirac-encoder0 libopencore-amrnb0
  libopencore-amrwb0 libopenjpeg2 libvo-aacenc0 libvo-amrwbenc0 libx264-123
0 upgraded, 9 newly installed, 2 to remove and 0 not upgraded.
Need to get 7,656 kB of archives.

After this, other commands and actions are now working, including those to convert to mp3, like avconv -i %f %f.mp3. To see that in Terminal, I have added to Thunar custom actions: gnome-terminal --window-with-profile=new1 -e "avconv -i %f %f.mp3". (In Gnome Terminal, create a new profile called "new1" and edit it ('Edit/Profiles/Title and Command') to 'When command exits: Hold the Terminal open'.)

Even after this, the aif files cannot be played by Totem, Parole, Xine, DeaDBeeF, Banshee or VLC; even in Audacity the sound is badly distorted, just like in Audacious. But mplayer (SMPlayer, Gnome Player, Mplayer) can play them just fine.

  • if you feel Crackly sound http://askubuntu.com/questions/182164/lots-of-static-crackling-noises-after-alsa-hda-dkms-installation/270947#270947 – Qasim Apr 27 '13 at 15:19
  • @XxxXxx - that bad sound happens only for the .aif files –  Apr 27 '13 at 15:21
3

There is one more program named assoundconverter and you can install it with your terminal
sudo apt-get install soundconverter .

from the EDIT -> Preferences options you can customize it as you want. enter image description here

This will convert any format to mp3 and other. hope that helps.

Raja G
  • 102,391
  • 106
  • 255
  • 328
1

To convert to FLAC:

flac [INPUTFILE]

(If you find flac isn’t installed: sudo apt-get install flac.)

flac man page here, showing options.


Similarly, in order to convert to mp3:

sudo apt-get install lame

lame [inputfile]