Recording RealAudio Streams to MP3
My simple solution for converting a RealAudio stream to MP3. Update: everyone is now providing podcasts of radio, so there isn't as much need for this manual process.
I used to use this to record the daily Life Matters show on ABC's Radio National (which is as close as we get to NPR in Australia). I assume the technique will work with any stream that mplayer can understand.
Configuration
You'll need mplayer with all the extra codecs (RealAudio at least in this case). Sorry, I'm not going to tell you how to set this up. Google told me.
Process
I would have preferred to use a single mencoder command, but it requires that you have a video stream. This is pure audio, so I can't use mencoder. (Please tell me that I'm wrong!!).
The mplayer FAQ suggests you use a fifo. This didn't work for me but I have enough diskspace to simply dump the audio to a file.
The Life Matters stream comes in two parts (one for each hour of the show). As mplayer didn't like the .ram files I extracted the rtsp URLs from the .ram. Life Matters uses a consistent URL syntax, which means I can automate all of this.
First, download the stream into a PCM audio file:
mplayer -cache 128 -vc dummy -vo null -ao pcm -aofile raw.pcm rtsp://media1.abc.net.au/rn/mod/lifemats_16122004_2856.rm
Next I encode the PCM to MP3 (32kbs is the same as the RealAudio stream, although I assume we lose a bit of quality in the conversion).
lame -b 32 -m m -f --tt "Life Matters - Thu 16 Dec - P1"
--ta "ABC Radio National" raw.pcm lifematters.mp3
Next on the todo is find a way to automatically copy the MP3s to my iPod.
BTW, the URL for the second hour of the show can be seen below:
mplayer -cache 128 -vc dummy -vo null -ao pcm -aofile raw.pcm rtsp://media1.abc.net.au/rn/mod/lifemats_2_16122004_2856.rm
This technique would work with the live streams but I haven't found a need to do this yet.