DIY Podcasting

Posted on Fri 12 August 2005 in general

My Mum asked me how to save a Real stream so she can listen to it at a later date. Unfortunately although technically possible the player denies you this ability (there is a lesson about proprietary software for you). Although the BBC is experimenting with podcasting (AFAICT another name for putting mp3's on a webpage) they don't offer all their programs in this format yet.

Ideally what I need is an rtsp:// aware version of wget which can just save a stream. However in the meantime there is a workaround. First of all you need the URL of the stream. I used mplayerplug-in's
handy "Copy URL" facility although you could probably get the same result by looking in the .ram file which contains the list of streams. Then its just a case of using mplayer to play the stream to a raw wav file and then re-encoding it to mp3.
10:55 alexjb@okra [tmp] >mplayer rtsp:// -ao pcm
MPlayer 1.0pre7-SUSE-9.3-i586-Packman-3.3.5 (C) 2000-2005 MPlayer Team
Playing rtsp://
Resolving for AF_INET6...
Couldn't resolve name for AF_INET6:
Resolving for AF_INET...
Connecting to server[]:554 ...
Cache size set to 640 KBytes
Connected to server:
Cache fill: 18.75% (122880 bytes)    REAL file format detected.
Stream description: audio/x-pn-multirate-realaudio logical stream
Stream mimetype: audio/x-pn-realaudio
Clip info:
 name: Book Of The Week - Tuesday
 author: BBC Radio 4
 copyright: (C) British Broadcasting Corporation 2005
Opening audio decoder: [realaud] RealAudio decoder
opening shared obj '/usr/lib/codecs/'
Audio codec: [23] 44 Kbps Stereo Music High Response - RealAudio
Audio bitrate: 44.100 kbit/s (5513 bps)
AUDIO: 44100 Hz, 2 ch, s16le, 44.1 kbit/3.13% (ratio: 5513->176400)
Selected audio codec: [ra10cook] afm:realaud (RealPlayer 10 COOK audio)
Checking audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
AF_pre: 44100Hz/2ch/s16le
[AO PCM] File: audiodump.wav (WAVE)
PCM: Samplerate: 44100Hz Channels: Stereo Format s16le
[AO PCM] Info: fastest dumping is achieved with -vc dummy -vo null
PCM: Info: to write WAVE files use -waveheader (default).
AO: [pcm] 44100Hz 2ch s16le (2 bps)
Building audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
Starting playback...
Stream EOF detected
Exiting... (End of file)
11:11 alexjb@okra [tmp] >mv audiodump.wav tuesday.wav
11:11 alexjb@okra [tmp] >lame tuesday.wav tuesday.mp3
AME version 3.96.1 (
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding tuesday.wav to tuesday.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
 34417/34419 (100%)|    1:09/    1:09|    1:15/    1:15|   12.934x|    0:00
average: 128.0 kbps                    MS: 34420 (100.0%)

Writing LAME Tag...done
ReplayGain: -2.7dB

Et voila, an mp3 of a BBC realplayer stream.