Tuesday, April 7, 2009

Howto: Save Streaming Real Audio Files for 'Offline' Listening

This walkthrough aims to give a demonstration of how to download a Real Audio stream and convert it to either Ogg Vorbis or mp3 format for offline listening at a later time. I will use a BBC news broadcast to demonstrate this technique.

First download the required tools from the repository:

Code:

sudo apt-get install mplayer vorbis-tools lame

Next use the following commands to download the stream to your Desktop:

Code:

$ cd $HOME/Desktop
$ mplayer -playlist http://www.bbc.co.uk/worldservice/meta/tx/nb/summary5min_au_nb.ram \
-vc null -vo null -ao pcm:fast:waveheader:file=news_stream.wav

I have a certain loathing for blindly copying CLI options into a Terminal without actually understanding what I am doing. So I will pause while the file is encoding in realtime to explain a few terms and options, drawing this material directly from the man pages:

* mplayer
mplayer is a movie player for Linux. It plays most MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files, supported by many native and binary codecs. You can watch Video CD, SVCD, DVD, 3ivx, DivX 3/4/5 and even WMV movies, too.
* - playlist
Plays files according to a playlist file: ASX, Winamp, SMIL, or one-file-per-line format. The ram file is not a media file in itself, it contains directions to the actual media file. mplayer's -playlist option can read these directions and subsequently open the media file. How cool is that!
* -ao pcm:file=news_stream.wav
Audio output is PCM (Pulse Code Modulation: the most common method of encoding an analogue audio signal into a digital bit stream) and the resulting default wav file will be named news_stream.wav.
* -vc null -vo null
Do not play/encode video. This setting may result in faster encoding and obviously in a Real Audio sound broadcast there will be no video anyway.

Now there should be a large wav file sitting on your desktop, so before anything else run it through any music player on your system and make sure it works! The following commands show the syntax to convert this file to either Ogg Vorbis or mp3 format:

Ogg Vorbis:

Code:

$ cd $HOME/Desktop
$ oggenc news_stream.wav -q 6 -o BBC_news.ogg

mp3:

Code:

$ cd $HOME/Desktop
$ lame news_stream.wav --preset standard -o BBC_news.mp3

How easy is that? There are of course many more exciting streams out there than the BBC World News and I encourage you to explore. But perhaps you will also visit For the God Who Sings and see the radio series that started my exploration of this technique?

>http://ubuntuforums.org/showthread.php?t=542276

No comments:

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.