A shell script for saving streaming audio
Wanted to share a shell script I wrote a while ago for saving streaming audio to MP3/Ogg, its nothing fancy but some might find it useful.
mplayer -dumpstream $1
mplayer -ao pcm stream.dump
lame audiodump.wav $2
rm stream.dump
rm audiodump.wav
(told you it was nothing fancy)
Basically, once you have downloaded a file containing the stream address you find the url of the stream with the command
$ more file.[asx/m3u/pls]
which will be mms://something
You can then use a single command (assuming you put the script in /usr/bin) to download the stream and covert the audio to an MP3 or Ogg file by typing:
$streamsaver [mms url] [desired file name]
I've never got round to doing much more with it, but if its possible having it extract the mms url from the file itself would eliminate the first step. Beyond that the only other thing I've tried to do is have it start recording from a stream and stop at a particular time- a friend had a show on a campus radio station that didn't have a podcast or stream shows individually- that was my first experience with cron and got very messy :-/ So if anyone wants to add and share those functions feel free :-)
|