aoakley.com

getram

A Linux/BSD shell script to convert RealAudio, Windows Media and MP3/Shoutcast streams such as BBC feeds into .mp3 files (translation: it lets you record radio shows and play them on your iPod).

Public domain by Andrew Oakley.
Latest version always available from: www.aoakley.com/misc/getram

Requires MPlayer v1.0 or newer
Requires LAME
Requires mp3info

Usage:

getram [-d] [-m] [-t N] streamnickname | streamurl [outputfilename]

-d : datestamps yyyymmdd-outputfilename
-m : mono 24 kbit/s (default is stereo 96 kbit/s)
-t : timeout (stop recording) after N seconds

Predefined stream nicknames (edit the script to add more):

r2  : BBC Radio 2
r4  : BBC Radio 4
r4x : BBC Radio 4 Extra (formerly BBC7)
r5  : BBC Radio 5
rg  : BBC Radio Gloucestershire
ws  : BBC World Service (Europe & Africa feed)
wn  : BBC World Service (24/7 news feed)

Examples:

getram -d -t 1800 r4 Radio4-Live.mp3

...records 30 minutes of live BBC Radio 4 in 96kbit stereo and datestamps it.

getram -m "http://wsdownload.bbc.co.uk/worldservice/css/32mp3/latest/bbcnewssummary.mp3" ws-news.mp3

...records the whole of the most recent World Service news bulletin in 24kbit mono (very small file ideal for downloading over 2G/EGPRS rural mobile internet).

Recent improvements: (to v0.13 Dec 2014)

  • Now has a timeout option (-t N) so you can record N seconds of a stream and then stop. Ideal for combining with crontab to record live programming - no need to wait for the BBC to encode the show for Listen Again.

  • Now uses low bandwidth RealAudio stream if encoding to low bitrate mono. Ideal for conserving bandwidth and audio quality if you may be using your bandwidth for other things at the time. Stereo will continue to use the maximum bandwidth stream available.

  • Now sets artist and album (by default, "Radio" and "Recorded Programmes"). These are hardcoded into the script. The album is set to the stream/radio station name if a stream nickname is used.

  • Default stereo encoding rate upped from 64kbit to 96kbit.

  • Now includes Windows Media streaming and Shoutcast as well as Real Audio.

  • Now includes a set of predefined BBC radio streams.

    Bugs:

  • Commandline options must be placed in strict order as per usage guide.

  • Artist and album cannot be changed except by editing the hardcoded variables in the script.

  • Some versions of mplayer seem to dump all RealAudio to PCM as mono. This is not a bug with the getram script per se, but annoying nonetheless.

  • Very little, if any, error handling.

  • No installer, no dependency checking and no manpage.

  • The script name is almost obsolete. RAM used to mean Real Audio Media, but that kind of streaming is now rarely used.

  • get-iplayer is way, way better.

    Public Domain - Andrew Oakley - 2007-09-10

    Top - More Broadcasting Articles - More  Computing Articles - Article Index - aoakley.com