NOTE: YOUR ARE BROWSING THE ARCHIVES OF NEURAL GOURMET.
You will only find content here prior to May 1, 2008. For newer content, please see our main site.
how to | Neural Gourmet Archives

how to

I really like to listen to BBC Radio programs. Unfortunately the BBC chooses to make their programs available in Real Audio format which I really dislike. Really, really, really dislike. It also means I can't put the programs on my MP3 player. Well, courtesy of Stuart we have a handy script for quickly and easily saving our favorite BBC Radio programs under Linux.

The only tricky part is extracting the proper RTSP URL. Thankfully Stuart provides us with an easy method to do this as well:

Obtaining the ram file is still pretty easy, in fact using the command line to get it is easier than copying the previous link. So on a Linux command prompt enter:

curl http://www.bbc.co.uk/radio/aod/genres/comedy/aod.shtml?radio4/nowshow | grep [.]ram

Where the link is a copy of the link to start playing the file. This should give one line on the console starting something like:

<a href="/radio/aod/shows/rpms/radio4/nowshow.ram">
<img src="/radio/aod/images/ico_realplayer.gif" width="16" height="12" alt="" border="0" align="left" vspace="1" />Listen using stand-alone Real Player</a><br clear="left" />

Put this link to the .ram file into my script ... [and] add the http://www.bbc.co.uk on the front, and this will create an mp3 or ogg file of the show.

I've mirrored Stuart's handy script, which he makes available under the GNU GPL, here just in case it should ever go missing. Use the attachment link at the bottom of this post to download it and rename to listenagain.sh.


tng | 2007-05-08 22:33

I've been slacking lately, but for good reason! I'm really, amazingly, incredibly, mind-numbingly busy right now. And I've got a lot of stuff to get done too. So as a sort of peace offering I offer you this little how-to, entirely adopted from a comment on Richard Dawkins' site by benh. Personally, I find this very handy. I hate RealAudio for a number of reasons, not the least of which is because it won't play on my mp3 player (which does a number of formats).

This one's for you Linux geeks, though you Mac heads should have no problem either. It could be done on Windows, but for the purpose of this how-to I'm going to assume you've got some form of *BSD/*nix and both mplayer and lame installed. Start out by opening up terminal window and then...

  1. Obtain the stream URL
    • wget http://URL_of_realaudio_program/filename.ram
    • cat filename.ram (benh suggests using vi to edit the file, but just cat'ing it to STDOUT should work fine)
    Copy the line beginning with rtsp
  2. Download the stream using mplayer
    • mplayer -dumpstream rtsp://the_stream_url_copied_above
  3. Once the stream is downloaded, convert it to a wav file
    • mplayer -ao pcm stream.dump
  4. Once this is complete, you will have a file called audiodump.wav in your working directory, to convert this to an mp3 you will need a program called LAME.
    • lame --preset standard ./audiodump.wav ./filename.mp3

And that's all there is to it. Thanks to benh for concise and clear instructions. A great workaround to a truly inconvenient audio format!


Syndicate content
Navigation

Neural Gourmet Visitors
Locations of visitors to this site



Syndicate