Sunday, December 14, 2008

Saving streaming wmv files with Linux

This past week my sister-in-law was on the radio in NYC and my father-in-law wanted me to try and record it for him. Since I live in North Carolina, obviously the only way to do that would be to stream it over the web. I figured finding and listening to the stream would be the easy part. I listen to streaming radio ALL the time (thanks WUNC!).

Before getting into all of this, you are likely going to need to install some applications. Everything I used was available through the Ubuntu repositories though I do have Medibuntu enabled in addition to all the other easily enable able ones (main, universe, restricted and multiverse). This was also all done using 8.10 Intrepid Ibex. I also know I have several of the restricted packages installed which I am pretty sure is the only reason Windows Media files work. Now for the details.

The hard part would be to actually save the stream. Here is a step by step of what I did:

  • Obviously the first step was to find a stream of the station. She was playing on WQXR - 96.3 FM and I found their Windows Media stream on PenguinRadio.
  • I found that VideoLAN - VLC media player would be my best bet. It also works in Windows too. I didn't try this on Windows but I bet it would work the same with VLC.
  • I had the hardest time trying the many command line options for vlc. I really wanted to download the file and transcode it to wav or directly to MP3 but I just couldn't get that to work. Instead I just saved it directly as WMV and decided to worry about the rest later. I had some trouble with all the many GUI options too so I went with the safer command line route. I used the command line:
    vlc -vvv "http://htc-01.media.globix.net/COMP005996MOD1/meta/wqxr_live_high.asx" --sout '#duplicate{dst=display,dst=std{access=file,mux=asf,dst=/home/forrest/download.wmv}}'
  • Here is the easy to replace version: vlc -vvv "MY_STREAM" --sout '#duplicate{dst=display,dst=std{access=file,mux=asf,dst=MY_DOWNLOAD_FILE}}'

After all that I had a 34.1MB wmv file with just under 27 minutes recorded. At this point I converted it to a wav using mplayer like so: mplayer download.wmv -ao pcm:file=download.wav

Since I wanted to play it safe and be sure not too miss anything I needed recording, I started to recording early and kept it going past time. At first I wanted to use Audacity to trim the file but I had a problem getting that to work so I used a program called sox. To truncate the wav with sox you just specify the trim option, the start time and how long to run (NOT the end time). In my case it was: sox download.wav download-trim.wav trim 14:50 9:39

Next I converted the wav to MP3 so I could make it easy to get to online before burning it to a CD. I was sick of command line options at this point so I used SoundConverter instead of Lame (though it likely uses lame as a back end anyway) to save me the trouble.

Tuesday, December 2, 2008

Upgrading to Ubuntu 8.10 (Intrepid Ibex) from 8.04 LTS (Hardy Heron) on my home desktop (in pictures)

Despite Ubuntu 8.10 (Intrepid Ibex) being out for over a month now, I just got around to upgrading today. I use my Linux box for web browsing, watching videos, general web development and other day to day tasks so I couldn't afford for it to be down long if the upgrade went badly. Fortunately, the upgrade worked like a charm. So here is the upgrade process that took a total of 1 hour and 15 minutes in pictures:











At this point something was upgraded that caused the border to not show up in the screen shots. Oh well.










After the upgrade the theme was a little funky. I went into the theme editor and changed the theme a few times and it was back to normal. I did see the new dark theme and I am going to give it a try for a little bit. I don't think it will last long but it does look pretty good at first. I also switched to the default background for a bit too.