Convert m4a to mp3

M4a is the standard audio format used by iTunes Store. All songs that are available for download in the iTunes Store use this format. So if you want to convert your m4a files to mp3 files, you can use Avconv which is a very fast video and audio converter that comes with the Libav library.

To be able to use this converter, you need to install the Avconv package:

sudo apt-get install avconv

Now, you need to navigate to the directory that contains the m4a files that you want to convert:


NOTE: /home/YOURNAME/YOURFOLDER is the full path to the folder where you have stored the m4a files.

To convert all the m4a files in this folder,  paste Ctrl+Shift+V this command into the terminal window:

for k in *.m4a; do avconv -i "$k" -b:a 320k -c:a libmp3lame "$(basename "$k" .m4a)".mp3; rm "$k"; done

This command loops through the chosen directory, converts all m4a files to mp3 files and then deletes the  m4a files. If you want to keep the original files (m4a), remove this part: rm "$k";.

TIP: You can use the mc command to browse directories directly from the terminal window. To install it, run the following command:

sudo apt-get install mc

To launch this tool, type mc in a terminal window and use the  arrow keys to navigate between directories.

Some parts are inspired by: This page & Basename

Tags: ,