Update: This post is now outdated because as andrew.46 notes, "FFmpeg has dropped support for the non-free amr libraries in favour of opencore-amr". See his opencore-amr post for more info.
You can use ffmpeg. If you're using Ubuntu Hardy you can use ffmpeg from the Medibuntu repository. I believe it has support to decode AMR.
Originally Posted by tdn
If you're using Ubuntu Intrepid you will have to compile ffmpeg yourself:
HOWTO: Compile the latest ffmpeg and x264 from source
If you follow that guide, you will need some additional steps to use AMR. First download the amr development packages from the Medibuntu repository:
Then when you configure ffmpeg (step 5 in the guide), you will need to add additional configuration options:
sudo apt-get install libamrnb-dev libamrwb-dev
The ffmpeg command to convert to flac is relatively simple:
For ogg vorbis you have several choices depending on how you configured ffmpeg:
ffmpeg -i inputfile.amr outputfile.flac
ffmpeg -i inputfile.amr -acodec vorbis outputfile.ogg
ffmpeg -i inputfile.amr -acodec libvorbis outputfile.ogg