/dev/sr0 may have to be replaced with another device file depending on your system.
cdda2wav -D/dev/sr0 -B -x
Parameters:
flac --best *.wav
neroAacEnc is needed for the following snippet. The quality of the resulting aac files is better with NeroAAC than ffmpeg or libav (I don't know if they got better now).
while read FILE; do flac -d -c "${FILE}" | /opt/NeroAAC/neroAacEnc -q 1 -ignorelength -of "${FILE/.flac/.m4a}" -if -; done <<< "`ls -1 *.flac`"
avconv -i 00000.m2ts -qscale 0 -f matroska output.mkv
avconv -i asdf.webm -map 0:1 -c:a copy audio.m4a