Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

m4a to mp3


To convert a directory of iTunes m4a format files to mp3 we can use Debian's faad and lame packages. Install them with:

  $ wajig install faad lame

You can then run the commands faad to convert to wav format and then lame to convert to mp3 format.

  $ faad -o abc.wav abc.m4a
  $ lame -h -b 192 abc.wav abc.mp3

The -h option of lame requests the production of higher quality output (taking more time to do so) and the -b option results in a bitrate of 192kbps for the resulting mp3.

A simple script can be created to transform a directory of m4a files. You could put the following script into a file (first line should be #!/bin/sh) and call the file /usr/local/bin/m4a2mp3 with the appropriate permissions (chmod a+rx /usr/local/bin/m4a2mp3). Or you can simply select this code and paste it into a command line Terminal.

  for i in *.m4a
  do
    faad -o - "$i" | lame -h -b 192 - "${i%m4a}mp3"
  done

The recipe iterates over all files in the current directory that match the pattern *.m4a (i.e., all files with an extension of m4a). The faad command is applied to each m4a file in turn (the $i argument is quoted in case the filenames contain spaces). The - argument to the -o option of faad indicates that the output should be to the standard output, which is then piped to the lame command. The ${i%m4a}mp3 replaces the m4a extension with the mp3 extension in the filename.

Copyright © 1995-2006 [email protected]

 
 
  Published under the terms fo the GNU General Public License Design by Interspire