Content Cleanup Required
Capturing streamed audio as .mp3
This technique lets you make high-quality recordings from streamed internet radio.
Internet radio stations are a rich resource. More and more of them are archiving their audio material. Sometimes this can be simply downloaded, as a Podcast (usually .mp3, sometimes .ogg). More often the audio is ‘streamed’ – i.e. the file plays directly but can’t be saved.
This guide tells you how to capture Real Audio .ra and .rm streams (the most common kind).
Some stations also stream .mp3 and .ogg. There is a separate guide for those, using Stream Tuner and Stream Ripper, here.
You can also record the audio from the sound output using something like Audacity – but the quality is limited by your sound card. With this method you’ll be grabbing the digital audio stream file directly. This process is called ‘Ripping’, as opposed to ‘Recording’
NOTE: In most countries it is legal to capture streamed audio, provided that this is for personal use and not for further duplication or commercial re-use. However - note the comments here. Use at your own risk.
Install Real Player - this is the easiest way to listen to the audio streams.
Install the other software you’ll need – Vsound and Sox to grab the audio stream. Lame to convert it to a .mp3.
Find an audio stream – it can be slightly tricky to find the URL.
Capture your stream - you'll end up with a large .wav file.
Convert your stream to a .mp3 file - to shrink it down to size and make it work on your portable player.
How to install Real Player
Install the other software you’ll need
Read here for general instructions on how to install software.
The packages you need are vsound, lame and sox.
Vsound grabs audio streams
Sox converts them to a very large .wav file
Lame is a handy package for converting most audio file types to most others.
You may already have these installed. Otherwise, with Universe and Multiverse repositories enabled, type the following in a terminal window:
sudo apt-get install vsound sox lame
And you’re ready to start looking for audio streams.
Finding your Audio Stream
Vsound needs to know the URL of the audio stream it is grabbing. This may not be obvious at first glance. For example, some sites, like NPR (eg here), nest the URL inside a .smil (Standard Multimedia Integration Language) file. If you click on the links you will be offered the .smil file to either play in Real Player or save to disk. Save it. Then open it with a text editor (right-click). Inside, you will see the URL.
Elsewhere (eg. BBC Radio, here) you will be offered a .ram file (On the BBC site, right click on 'Play in standalone Real Player' buttons). Again, save it locally and peek inside using a text editor.
In either case you’re looking for a URL which ends with a something.ra or something.rm filename.
Select and copy the URL.
Some station URLs are listed on this page: RadioURLs
Capture your Audio Stream
Now let’s get to work.
NOTE: before you start, you are going to be making some massive .wav files – approx 10MB per minute of recording. Make sure you have enough disk space for the time you want to record. You’ll need about (2.1 x 10 x recording length in minutes)MB.
Open up a terminal window:
vsound –-timing –-dspout –-file=myfilename.wav realplay url_of_the_stream_you_want_to_rip
Realplayer will open up and play the stream (the –-dspout parameter means you can listen while ripping). At the same time, it will generate a large Sun ULAW format file containing the stream. When it’s got what you want, close down Real Player. Sox will start up, create a .wav file from the ULAW, then delete the ULAW. This may take some time – but you can monitor it in a file browser.
Converting to .mp3
To convert the massive, unwieldy .wav to a more manageable .mp3 (approx 10% of its size), simply:
lame myfilename.wav myfilename.mp3
A dialogue will open in your terminal showing the process. Again, this may take time, depending on your processor speed and the file size. You can use Audacity to edit the .mp3 further – eg to make breaks between songs.
This information was based in part on an article in Linux Magazine: http://www.linux-magazine.com/issue/57/Ripping_Audio_Streams.pdf
bash RunRadioRip4.sh "url" "filename"
bash RunRadioRip4.sh "url" "filename" "lame options"
the default lame options, if unspecified, are "-V 3 --vbr-new" but they can be changed (e.g. "--preset voice") instead.
This page does not explain how to rip RTSP video; for example rtsp://realstreams.omroep.nl/bobo02/1/media/tv/vpro/hollanddoc/HD Onderhandelaar-sb.rm