[NBLUG/talk] Grabbing streaming audio to file

Scott Doty scott at sonic.net
Fri Jun 4 05:47:35 PDT 2004


On Thu, Jun 03, 2004 at 11:39:49PM -0700, Glen Gunsalus wrote:
> I would like to save streaming audio from one of the "local" FM stations to 
> file so I can listen to it when I'm actually in the house.
> 
> I thought this would be a perfect chore for "chron" or "at" using perhaps a 
> command line realplayer, but 1) can't seem to redirect to a file, 2) can't 
> find correct command line to grab what I want from KQED stream.
> 
> I'm currently running RH 7.3.
> 
> Any pointers gratefully accepted and acknowledged.
> 
> Cheers, Glen

Hi Glen,

Realplayer won't give you any love in this endeavor.  The command-line tool
"mplayer" will do exactly what you ask, however:

   http://www.mplayerhq.hu/

Mplayer is a veritable swiss army knife of media encoding, transcoding, and
playback.  Indeed, it is the tool that allowed me to make the final break
with Windows, as mplayer plays Microsoft streams (though I don't think it
understands DRM (yet?)).

Anyway, the command in question would look something like:

   mplayer -dumpstream -dumpfile try.mp3 http://example.com:8000/

This would write a file "try.mp3" from the stream on the shoutcast server
"example.com".

Caveats:

My version of mplayer knows how to handle rtsp:, but that may have come along
with the "live" library.  In fact, I'm almost sure of it, as when I try an
rtsp: URL with an mplayer binary built without "live", I get:

   RTSP support requires the "LIVE.COM Streaming Media" libraries!
   Unable to open URL: rtsp://example.com:8000/

 ...so it may be a bit of an adventure getting that going.  I've appended
my "Do_Config" for mplayer, some options which you may want to add to your
./configure statement...

I should also mention that I've had trouble capturing some Realmedia
streams, notably air america's stream -- your mileage may vary.  (I'd be
happy to test if you would give me the URL in question...)

 -Scott
p.s. my "Do_Config" script to configure mplayer:
#!/bin/sh

./configure     --prefix=/opt/MPlayer-1.0pre4 \
                --enable-largefiles \
                --enable-live --enable-qtx --enable-win32 \
                --with-win32libdir=/opt/win32codecs \
                --enable-debug

This sets the installation prefix to /opt/MPlayer-1.0pre4, enables large
file (+2GB) support, enables LIVE.COM library support (library already
installed), enables quicktime (Windows codecs from mplayerhq.hu installed in
/opt/win32codecs), enables Windows codes (/opt/win32codecs), and turns on
verbose debugging messages during compile, as well as compiling with
debugging symbols.  If you specify --enable-qtx, you must specify
--enable-win32.

Good luck! Let me know if you need a hand...




More information about the talk mailing list