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
(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 :-)
You could probably skip the file download to get stream address using the playlist option and putting the URL in the $1 argumant.
mplayer -dumpstream -playlist $1
I have done something very similar:
Slackware and "For The God Who Sings"
which shows one method of starting and stopping the stream.
|All times are GMT -5. The time now is 01:19 PM.|