LWN: Comments on "The Grumpy Editor's guide to audio stream grabbers" http://lwn.net/Articles/182954/ This is a special feed containing comments posted to the individual LWN article titled "The Grumpy Editor's guide to audio stream grabbers". hourly 2 modified recorder with simultaneous encoding and mp3 http://lwn.net/Articles/225257/rss 2007-03-08T17:27:00+00:00 devasura i replaced oggenc line by:<br> (cat $FILE.wav | oggenc --quiet -b $QUALITY - | tee $FILE.ogg | mplayer -cache 32 - &gt; /dev/null) &amp;<br> to enable playing while the stream is being recorded<br> modified recorder with simultaneous encoding and mp3 http://lwn.net/Articles/225058/rss 2007-03-07T20:28:12+00:00 devasura ignore the above comment, didnt read the full article<br> sorry<br> modified recorder with simultaneous encoding and mp3 http://lwn.net/Articles/225057/rss 2007-03-07T20:22:41+00:00 devasura some mplayer options seem to be decprecated, use:<br> mplayer -cache 32 -nojoystick -nolirc -prefer-ipv4 -playlist $1 -ao pcm:file= $FILE.wav -vc null -vo null <br> The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/203999/rss 2006-10-12T07:38:53+00:00 anonymous21 What you really would like (I think) is a program called Screamer Radio. It does not (unfortunately) have timed startup, but it does have these features:<br> <p> 1) Record button<br> 2) Mute button (so you can mute the audio stream while recording, and listen to some other audio using another player. Also great for manually muting annoying commercials during playback!).<br> 3) *** 5 minute audio buffer ***, so when you click "Record", it actually starts recording from five minutes prior to that moment, assuming you've been playing the stream for that long. So when you realize, two minutes into a program, that you wish you'd started recording it from the start, you now have that option (again, assuming you had actually started listening that far back - it can't record what it never had the chance to buffer!)<br> <p> The problem, of course, is that it only runs really well under Windows. You CAN install and run it under Wine, but if you do it will only play mp3 (and, I think, ogg) streams. Specifically, it will not play streams in Windows Media format, even though it plays those fine under Windows. Beyond that, under Wine it has a nasty tendency to freeze up unexpectedly.<br> <p> If someone would clone this program for use under Linux (or figure out how to make it work 100% under Wine, although I'd rather have a native Linux app), I for one would be appreciative.<br> FM http://lwn.net/Articles/184336/rss 2006-05-18T22:44:41+00:00 yem If it's FM you're after, a cheap USB FM tuner and a little scripting goes a long way.<br> <p> The national public radio station in NZ has only recently added online streams but a) it's not real time and b) it is of poor quality - think 24-48kbit mono wma format. I have some perl-fu that scrapes the online program listing, consults a PVR style config file of programs to record, schedules them with atd and takes care of encoding, file naming and archiving. Works a treat.<br> curl has timed downloads, unlike wget http://lwn.net/Articles/184321/rss 2006-05-18T21:05:59+00:00 nealmcb I've often wanted a timer for wget also. Then I learned that the popular 'curl' program and library has one....<br> <p> curl -m 3600 -s -S -o $f $url<br> <p> modified recorder with simultaneous encoding and mp3 http://lwn.net/Articles/184318/rss 2006-05-18T20:57:56+00:00 nealmcb Thanks, Stevan. My version of mplayer doesn't seem to take the<br> ":file" modifier to the "-ao pcm" option, so I used the "-aofile"<br> option instead.<br> <p> I also didn't like the idea of filling up my disk with the .wav<br> data until the recording was done, so I changed it to run the<br> encoder in the background. I couldn't do that via a pipeline<br> since mplayer doesn't seem to be able to write to stdout, so I<br> had to connect them via a named pipe. Here is my modification,<br> which also produces mp3 rather than ogg since that is what my<br> nokia tablet knows how to play by default.<br> <p> ----<br> #!/bin/sh<br> # record a stream with mplayer, e.g. realaudio, saving it as an ogg vorbis file<br> <p> # todo: trap terminate signal and kill encoding process, remove named pipe<br> # consider option for dumping raw format via -dumpstream -dumpfile,<br> # and later conversion<br> <p> # based on Stevan's script at <a href="http://lwn.net/Articles/182954/">http://lwn.net/Articles/182954/</a><br> # See also scheck's 'srec' script there<br> <p> usage="$0 url name"<br> <p> URL=$1<br> NAME=`echo $2 | tr " " _`.mp3<br> FILE=$RANDOM<br> QUALITY=48<br> <p> mknod $FILE.wav p<br> <p> (lame --quiet -V6 --vbr-new --resample 22 -m m $FILE.wav $FILE.mp3) &amp;<br> <p> # (oggenc --quiet -b $QUALITY $FILE.wav) &amp;<br> <p> mplayer -cache 32 -nojoystick -nolirc -prefer-ipv4 -playlist $1 -ao pcm -aofile $FILE.wav -vc dummy -vo null <br> <p> wait # wait for encoding process to finish<br> <p> mv $FILE.mp3 $NAME<br> rm $FILE.wav<br> <p> A bloated script for time-scheduled audio stream recordings http://lwn.net/Articles/184249/rss 2006-05-18T12:15:10+00:00 scheck <p> I wrote a small script for time-scheduled stream recordings and bloated it by extensive use of comments and a small "station database", which holds my favourite German radio stations. </p> <p> A mere <tt>echo 'srec myrockstation 60 "Iron Maiden Live in Lederhosen"' | at 22:00 Sat</tt> would take care of your desired one-hour-show on coming Saturday at 10pm while you go out with friends who listen to Madonna... ;-) </p> <p> BTW: if you adapt the mplayer command and the assignment of extensions, the script might also work with videos... </p> <pre> #!/bin/sh # # srec - stream recording # v0.01 2006-03-21 torsten.scheck@gmx.de # # Copyright is hereby assigned to the Public Domain. # # This script relies on wget or mplayer, depending on # the stream format. # parameter defaults station=${1:-"NoStation"} length=$((${2:-60} * 60)) name=${3:-"Unnamed"} # time period in seconds, after which the dumping process is checked checktime=10 # choose station from database and build station list url='' list='' add() { list="$list"$(printf "%-8s %-3s %-25s %s" "$list_station" "$list_ext" \ "$list_info" "$list_name")"\n" if [ "$station" == "$list_station" ]; then ext=$list_ext info=$list_info url=$list_url fi } ############################################################ list_station="dlf" list_ext="ogg" list_name="Deutschlandfunk" list_info="96 kbps, variable, stereo" list_url="http://dradio-live.ogg.t-bn.de/dlf_high.ogg" add list_station="dlfmp3" list_ext="mp3" list_name="Deutschlandfunk" list_info="48 kbps, constant, mono" list_url="http://dradio-live.mp3.t-bn.de/dlf_live" add list_station="dlfwma" list_ext="wma" list_name="Deutschlandfunk" list_info="48 kbps, constant, stereo" list_url="mms://dradio-live.wm.t-bn.de/live/dlf/dlf" add list_station="dlrk" list_ext="ogg" list_name="Deutschlandradio Kultur" list_info="96 kbps, variable, stereo" list_url="http://dradio-live.ogg.t-bn.de/dkultur_high.ogg" add list_station="contra" list_ext="ra" list_name="SWR Cont.Ra" list_info="44 kbps, stereo" list_url="rtsp://213.254.239.61/farm/*/encoder/swr/contra/livestream.rm" add ############################################################ filename="${name}_${station}_$(date +%Y%m%d_%H%M).${ext}" logname="${filename%.*}.log" # display help when station name is not found or wasn't provided if [ -z "$url" ]; then echo "Usage: $0 STATION [LENGTH in minutes] [NAME] Saves an audio stream of a given internet radio STATION to a file in the current working directory. LENGTH defaults to 60 minutes and NAME defaults to 'Unnamed', so the resulting file name looks like this: ${filename}xxx The download process is logged to a separate file using the suffix 'log'. This script is best used with the Unix tool 'at' for time-controlled recordings. For example, try this to record the 55-minutes-show 'Querkoepfe' on the station 'Deutschlandfunk' next Wednesday at 21:05 including some 'safety minutes' before and after the show: > echo 'srec dlf 60 Querkoepfe' | at 21:03 Wed Mind your time zone and get the list of your locale's supported abbreviations for the time specification with: > locale -c LC_TIME Available stations:" >&amp;2 echo -ne "$list" | sort >&amp;2 exit 1 fi # use 'wget' as default tool and 'mplayer' for special streaming formats case "$ext" in ra|wma) util="mplayer";; *) util="wget" esac # quit if needed tool is not installed type "$util" >/dev/null 2>&amp;1 || { echo "Please install '$util'."; exit 1; } # all output is redirected to logfile for easier 'at' usage exec >> "$logname" exec 2>> "$logname" until # start background process to dump stream to file if [ "$util" == "mplayer" ]; then mplayer -vo null -vc dummy -dumpstream -dumpfile "$filename" "$url" &amp; else wget -nv -O "$filename" "$url" &amp; fi # keep process id of bg process mypid=$! # in case of SIGINT and SIGTERM: kill bg process before exit trap 'kill $mypid; exit;' 2 15 # wait until bg process figured out if stream is available # e.g. "ERROR 504: Server Full" ends the bg process sleep $checktime # check if process is still here, i.e. the stream is being downloaded, # or if the recording length is reached kill -0 $mypid >/dev/null 2>&amp;1 || [ $length -le 0 ] do echo "Server problem, another try: $(date '+%Y%m%d %H%M%S')" # decrease recording length by checktime; in the case of a transient # problem the remaining length of the stream will be saved length=$((length - checktime)) # retry download with another until loop done if [ $length -gt 0 ]; then # wait recording length sleep $length # kill bg process and wait for its termination kill $mypid wait else # the recording length had been reached by trying just to get # the download started # an unrecoverable problem prevented the desired download echo "Aborted." fi echo "$filename END: $(date '+%Y%m%d %H%M%S')" </pre> Let's find GUI players with a "record" button http://lwn.net/Articles/184231/rss 2006-05-18T09:35:00+00:00 jpetso Kaffeine has (in the "File" menu) a "Record stream" action. That may not <br> qualify for time-scheduled recordings, but should do well for audio- as <br> well as video-streams.<br> It Seems To Me http://lwn.net/Articles/183539/rss 2006-05-13T20:32:03+00:00 Baylink that the underlying reason for the subject of your complaint is that we're only recently starting to enter an environment wherein there are continuously streamed audio or video source from which one might *want* to record a times subsegment.<br> <p> (And let's remember that since streaming tends to be a regime of uncertain delays, any utility which *does* attempt to do this should start early and run long...)<br> The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183241/rss 2006-05-11T15:32:25+00:00 stevan May I humbly submit a little script that I use for recording BBC output, <br> especially BBC7 stuff from their "Listen Again" page. BBC output is in <br> Realaudio format, but I've used the same script for other formats too. <br> <br> You need the URL of the stream. This can usually be pasted from the <br> clipboard, but is sometimes hidden when you use the BBC RadioPlayer front <br> end. However, you can find the URL in your squid logs! <br> <br> The script accepts the URL and a final file name as arguments. Of course, <br> the final result is an ogg file. I hope someone will improve it so that <br> it becomes clickable app under KDE. <br> <br> <br> Stevan <br> ------ <br> <br> <br> <br> #!/bin/sh <br> <br> FILE=$RANDOM <br> QUALITY=48 <br> <br> mplayer -nojoystick -nolirc -prefer-ipv4 -playlist $1 -ao \ <br> pcm:file=~/Desktop/$FILE.wav -vc dummy -vo null <br> <br> cd ~/Desktop <br> oggenc -b $QUALITY $FILE.wav <br> rm $FILE.wav <br> mv $FILE.ogg `echo $2 | tr " " _`.ogg <br> <br> Not. Want. WAV. http://lwn.net/Articles/183188/rss 2006-05-11T11:17:26+00:00 smurf It's a lossily-compressed stream. You don't want to store that in uncompressed form (takes too much disk space, even these days...), and sound quality is very unlikely to be improved by re-compression. <br> non-free streams http://lwn.net/Articles/183173/rss 2006-05-11T09:29:15+00:00 cortana I have had success with 'mimms' in the past for capturing Windows Media MSS streams.<br> XMMS saves Vorbis http://lwn.net/Articles/183171/rss 2006-05-11T09:23:42+00:00 zooko I save copies of vorbis radio while listening to it with XMMS. There is a checkbox somewhere in the audio output ui options.<br> <p> mimms http://lwn.net/Articles/183166/rss 2006-05-11T08:45:57+00:00 jneves Simple, specifically for the mms protocol.<br> mplayer: -endpos http://lwn.net/Articles/183142/rss 2006-05-11T04:38:08+00:00 ewen MPlayer (mplayer and mencoder) has an -endpos argument, which will tell it long it should read/encode from a file or stream. It takes a value in hours:minutes:seconds (and optionally milliseconds). <br> <p> I've never actually tried this while dumping a network stream to disk (to my recollection), but it definitely works fine for timed duration recording off a TV capture card, and playback/transcoding from a file. If you already have MPlayer installed it may be worth experimenting with that.<br> <p> Ewen<br> The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183136/rss 2006-05-11T03:49:39+00:00 jmorris42 <font class="QuotedText">&gt; Regardless of why, a Linux user who has fired up totem, amarok, or xmms to</font><br> <font class="QuotedText">&gt; play an audio stream will not readily find a "record" option there.</font><br> <p> Ok, xmms doesn't have a nice simple record button, but it does allow saving of streams. And while it doesn't have a built in way to set the length that isn't a problem for a UNIXhead since xmms is scriptable.<br> <p> I have been known to use "at" to have xmms start a playlist a few minutes after the alarm clock as a backup when I really have to get up early. No reason the same idea couldn't be used to start and stop a recording.<br> non-free streams http://lwn.net/Articles/183115/rss 2006-05-10T22:12:56+00:00 rfunk I think this article aims too low. There are many ways to do this with an Ogg stream, or even MP3. But RealAudio or Windows Media streams are more of a challenge, and this article only hints at that issue. <p> I've done this sort of time-shifting on a RealAudio stream using <a href="http://www.linux-speakup.org/trplayer.html">trplayer</a>. <p> mplayer (with the right codecs installed) may be the best tool for capturing Windows Media streams. The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183109/rss 2006-05-10T20:55:21+00:00 havardk <blockquote> Hmm, the way most players support recording is by providing a "disk writer" output plugin which writes to a .WAV file instead of the sound card. I'm fairly certain XMMS ships with one, for example. </blockquote> Yes but that's not very practical for timeshifting. <p> XMMS can also dump ogg/vorbis and mp3 streams in original format, and that might be a good option, atleast if you want to listen to the stream at the same time. The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183070/rss 2006-05-10T17:39:01+00:00 maniax When I use mencoder/mplayer to edit/cut video files, there's the -frames option, which multiplied by the fps gives you the time the app will run. I just tested this with an audio-only stream, and it works ok, but you'll probably need to do some testing to be sure how long is a frame in the stream that you're recording.<br> The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183064/rss 2006-05-10T17:35:53+00:00 kwoot isn't vlc capable of capturing and saving streams. It worked for me in the past.<br> <p> greets,<br> mplayer - for those "proprietary" media formats http://lwn.net/Articles/183069/rss 2006-05-10T17:35:00+00:00 dowdle Ok, this article was geared for AUDIO but let's not forget that much of it applies to VIDEO too. <br><br>A lot of media you will find out there is in RealPlayer, Windows Media Player and various other formats... often with an rtsp:// or an mms:// type URL. I have found mplayer to be very handy for capturing almost every stream you can find... assuming you have installed all of those questionable codecs from questionable sources. <br><br><b>Play Back:</b> Once you have that proprietary media, how are you going to play it? With <b><i>mplayer</i></b>, <b><i>xine</i></b>, or <b><i>vlc</i></b> of course. <br><br><b>Getting the URL:</b> <b><i>mplayerplug-in's</i></b> "Copy URL" feature (or however it is worded) is very handy when pages attempt to hide the real URL of the media. I often start the media with the browser plugin, copy the URL and them dumpstream it with mplayer. <br><br><b>Re-encoding:</b> For converting those proprietary media formats into something more desirable, <b><i>mencoder</i></b> and/or <b><i>ffmpeg</i></b> are very handy. Getting to know some of mencoder's and ffmpeg's command line options and then making a cheat sheet keeps one from going crazy trying to read those techie man pages. There are various command line tricks for joining multiple media files into one... which is very handy when something like... say... PBS Frontline breaks their shows into 4 to 6 pieces. Ever want to extract the audio from a video and make it into an .mp3 or .ogg? You can once you learn the command line flags. <b><i>avidemux2</i></b> is handy for converting to ogm as well as performing various operations (cropping, FPS change, etc) in a reasonable GUI... although avidemux2 can be a little picky on poorly encoded original files. The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183057/rss 2006-05-10T16:35:41+00:00 MenTaLguY Hmm, the way most players support recording is by providing a "disk writer" output plugin which writes to a .WAV file instead of the sound card. I'm fairly certain XMMS ships with one, for example.<br> The Grumpy Editor's guide to audio stream grabbers http://lwn.net/Articles/183058/rss 2006-05-10T16:35:39+00:00 b7j0c very informative! i didn't even know many of these tools existed.<br>