How to convert .aif audio files to mp3?
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
.)
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.