GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Convert m4a to mp3 |
REVIEW 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 |
deb ftp://ftp.nerim.net/debian-marillat/ sid main |
$ faad -o abc.wav abc.m4a $ lame -h -b 192 abc.wav abc.mp3 |
-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 |
-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.