It used to be relatively straightforward to get BBC radio's streaming audio (both live and listen-again) as Real Audio, but as of late July 2008 they've changed the way they deliver it. Their flash-based iPlayer currently uses a DRM-encumbered ("protected") mp3 stream which they plan to change to AAC later ["Under the iPlayer hood for radio" - BBC radio labs]. They claim that they will continue to provide Real Audio streams alongside the newer wizzy formats, and their abysmal text-only "accessible" pages rely on these versions: however maintaining these evidently requires a degree of manual intervention which their shambolic organisation is not always up to, so the Real versions are not always available. In such instances, and to access the supposedly higher-quality mp3/AAC streams, one has to adopt other methods. But first the old way...
If I want to listen to the radio on the computer I can run a command like
aoss realplay
rtsp://rmlive.bbc.co.uk/bbc-rbs/rmlive/ev7/live24/radio3/live/r3_dsat_g2.ra
(I've got that packaged up into a one-line script). aoss
is
necessary on my system for reasons I don't really understand.
Alternatively:
gmplayer
rtsp://rmlive.bbc.co.uk/bbc-rbs/rmlive/ev7/live24/radio3/live/r3_dsat_g2.ra
Real player is a bit more elegant than gmplayer: it starts playing
quicker, without throwing unnecessary windows and dialogue boxes onto the
screen, and I prefer the look of it. I haven't been able to compile the
excellent smplayer
on my Debian
system (it's already packaged for ubuntu so I have it on my laptop) otherwise
I'd use that.
What I can do with mplayer, however, is download a Real Audio stream to a file, like:
mplayer -dumpstream -dumpfile outfile url
(which I've packaged up into a Perl script I call getreal
). This produces a .ra
file
which can be replayed by realplayer or mplayer, or converted by
ffmpeg
into .wav
, .flac
,
.mp3
or whatever other audio format ffmpeg understands.
I've since found
mplayer -dumpstream or getreal can also
download other streams, for example try:
mms://ms.groovygecko.net/groovyg/clients/meettheauthor/1412_hb.wmv
(Enjoy mplayer's sarcastic comment at the end of the download!) |
Attempting to capture the audio stream used by the flash-based iPlayer is non-trivial:
However in any FLOSS OS the audio output of any application, no matter how obfuscated or DRM-"protected", must be available in the clear to be played. In older systems vsound allowed one to capture the output of arbitrary applications, but this doesn't work for ALSA (the default sound system on popular current distros including Debian and Ubuntu). To capture sound output with ALSA the following (from the alsa.opensrc.org wiki) can be used:
amixer set 'Mix' cap
(see the wiki link above for further commands which may be required
depending on your hardware)
arecord -t wav -f cd outfile.wav
Then run the application (e.g. konqueror
http://www.bbc.co.uk/iplayer/console/episode/pid
where
pid
is the BBC's programme id)
When the programme has finished kill arecord
.
outfile.wav
should then contain the programme audio.
If arecord
isn't stopped after the programme ends it will
probably go on writing to its output file, potentially filling up the disk.
This could possibly be worked around by making it part of a script which
would kill it after the programme ends. (The duration of the programme would
have to be given to the script.)
Another issue is that any application outputting to ALSA (including possibly system beeps and so on) may perhaps get recorded along with the desired programme.