Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - General > Member Success Stories
User Name
Password Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.


  Search this Thread
Old 02-12-2011, 07:13 AM   #1
Registered: Sep 2002
Location: New Zealand
Distribution: Ubuntu 10.10
Posts: 38

Rep: Reputation: 15
Post 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 :-)
Old 02-14-2011, 03:24 PM   #2
Registered: Jun 2003
Location: Washington
Distribution: Fedora FC21, Raspbian
Posts: 341

Rep: Reputation: 41
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
Old 02-15-2011, 11:32 PM   #3
Registered: Oct 2007
Distribution: Slackware
Posts: 708

Rep: Reputation: 109Reputation: 109
I have done something very similar:

Slackware and "For The God Who Sings"

which shows one method of starting and stopping the stream.


audio, lame, mplayer, shell scripting, streaming radio

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
saving totem streaming video cipocip Linux - Software 11 06-16-2012 06:47 AM
saving streaming audio apolinsky Debian 2 01-29-2010 12:02 AM
shell script: saving output from command into a variable grcunning Linux - Newbie 7 01-26-2010 12:43 PM
LXer: Saving my sanity with Zenity : shell script interaction via the GUI LXer Syndicated Linux News 0 01-30-2009 07:00 PM
Saving Streaming Video Program yamaduc Linux - Software 1 06-19-2003 05:18 AM

All times are GMT -5. The time now is 05:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration