ASF stream ripper for Linux?

Posted by: tonyc

ASF stream ripper for Linux? - 21/06/2005 10:58

A couple of my hometown radio stations just started broadcasting online, and I'd like to record some programs. I've used streamripper in the past for Shoutcast streams, but this station is using Windows (ASF) format. Anyone know of any command-line based stream ripping utils for Linux? The ASF file plays fine in MPlayer, so it should be possible, I just don't know of any such programs for Linux. I'd rather not use some kind of "play it and record the sound card output" solution, I'd like something that goes right from ASF to WAV, MP3, or whatever.
Posted by: peter

Re: ASF stream ripper for Linux? - 21/06/2005 11:20

Quote:
I'd like something that goes right from ASF to WAV, MP3, or whatever.

ASF files are WMA files. If you rename them, the car-player might well be able to play them anyway. Otherwise, if you don't mind transcoding losses, can't you just pipe mplayer's output straight into Lame?

Peter
Posted by: andym

Re: ASF stream ripper for Linux? - 21/06/2005 11:22

I've used Kaffeine under KDE which allowed me to record a show that was in ASF format. It saved it as a WMA file so as peter says it should play on the empeg.
Posted by: tonyc

Re: ASF stream ripper for Linux? - 21/06/2005 12:20

Yeah, I know WMA == ASF for all intents and purposes. To be clear (and somewhat heretical) playing on the empeg isn't the concern here. These aren't ASF or WMV files. they're ASF streams. If they were files this would be a non-issue. The software I want would function like streamripper does for Shoutcast, that is, listen to live streams, and save them as some kind of audio format on disk. WMV would be fine for my purposes.

I'll look into Kaffeine, but I'm hoping for something command-line based so I can run it with cron jobs to record specific programs at specific times.
Posted by: peter

Re: ASF stream ripper for Linux? - 21/06/2005 12:37

Quote:
The software I want would function like streamripper does for Shoutcast, that is, listen to live streams, and save them as some kind of audio format on disk. WMV would be fine for my purposes.

Ah, sorry, that wasn't the bit I thought you were having trouble with. Depending on the exact stream format, mplayer is probably still the answer though: mplayer <mms: URL> -dumpstream -dumpfile <outfile>. Not sure how you tell it to only record for a certain duration though -- I got bored of the manpage after the first forty screens.

Peter
Posted by: tonyc

Re: ASF stream ripper for Linux? - 21/06/2005 12:53

Hmm. That seems to work perfectly. I did scan the mplayer manpage but somehow missed the dumpstream argument.

As for recording duration, I'll see if I can find the magic argument, but if not, I'll just send it SIGQUIT when the time has elapsed.

Thanks!
Posted by: tonyc

Re: ASF stream ripper for Linux? - 21/06/2005 13:13

Ah ha!

http://grimthing.com/archives/2004/05/20/recording-streaming-audio-with-mplayer/

It appears that killing it when the time has elapsed is the only way to go. I think I'll write a pid file and kill -QUIT instead of "killall -9" though.
Posted by: mlord

Re: ASF stream ripper for Linux? - 21/06/2005 15:43

No need for a PIDfile.. just have the script that launches it also terminate it.

For example, here (attached) is my bash script I use to record CBC radio, or any other stream.

Eg. save_stream.sh -seconds 20 cbc1

Cheers
Posted by: andym

Re: ASF stream ripper for Linux? - 21/06/2005 17:05

Nice, shame I can't use it with dvbradio (what I used to record Brads NIN stuff) as there are no command line options that do anything usefull. I just set it recording and stuck a killall -s 9 dvbradio in my crontab at the desired time.
Posted by: mlord

Re: ASF stream ripper for Linux? - 21/06/2005 17:14

Do you mplayer with the DVB stuff (it apparently supports it)?
Posted by: andym

Re: ASF stream ripper for Linux? - 21/06/2005 17:26

Might have to have a look. I'm supposed to be recording another show for him tonight.
Posted by: tonyc

Re: ASF stream ripper for Linux? - 21/06/2005 18:18

Indeed, that's almost exactly how I ended up doing it, minus the business with the cache.