Saturday, 19 May 2007

Converting m4a files to mp3

I have some m4a files I would like to keep in mp3 or ogg format. From what I found, you need to do this via the command line in Linux/Kubuntu.

For a refresher, m4a file are propietary iTunes music files. They may or may not have DRM, so they may or may not convert properly.

To convert a m4a file to mp3, you need faad and lame installed. Use Synaptic Package Manager to get them. Install. In your konsole/terminal, type:
$ faad foobar.m4a # to convert to wav
$ lame foobar.wav foobar.mp3 # to convert to mp3
If you need to change it to ogg, you need oggenc. Then you can do:
$ for nam in *.mp4; do nice mplayer -ao pcm "$nam" -ao pcm:file="$nam.wav" && nice oggenc -q5 "$nam.wav" -o "$(basename "$nam" .mp4).ogg"; rm "$nam.wav"; done
That's all one line. See link here and here.

1 comment:

Anonymous said...

Thanks. This is a quick and dirty way to re-encode m4a's to a more useful format.