- Install libmp4v2.
- Install FAAC (if the MP4-specific options show up in faac -h, then MP4 support is enabled).
- Optionally compile FAAD with ./configure --with-mp4v2 for AAC playback.
- Encode files on the command line with faac [options] infile.
Or use afconvert --verbose --file "m4af" --data "aac" INFILE OUTFILE, though that doesn't seem to work with data piped through FIFO from mplayer (mplayer crashes).
Update: faac seems to be producing strange artifacts in the audio. Maybe it's better to save WAV files and convert them to AAC with afconvert at the end.