capturing CBC Radio from an internet stream
Eric Battersby
gyre-Ja3L+HSX0kI at public.gmane.org
Sun Mar 2 07:57:25 UTC 2008
Hugh,
I wanted to do something similar to you, but your mail got me
thinking about, so I investigated further.
On Sun, 17 Feb 2008, D. Hugh Redelmeier wrote:
> This has taken a bit to figure out. I hope some others find this
> information useful.
>
> CBC Radio is streamed in two ways that I know about:
>
> - ogg vorbis: experimental. CBC Radio 1 in Toronto (only)
>
> - mms stream containing .wma. For each radio station.
>
> See http://www.cbc.ca/listen/index.html
>
> I would like to be able to report that ogg vorbis is the way to go,
> but there are two problems:
>
> - every time try to capture an hour-long show, I find the stream is
> broken off prematurely
I have not used ogg vorbis before.
I don't have any portable "MP3 players" that plays that format
and I've had about 10 players in the past.
I assume you are capturing it from:
http://vorbis.nm.cbc.ca/cbcr1-toronto.ogg
How are you capturing it?
I tried this to grab a 15s segment:
timeout -w 15 --
wget -v -O tmp.ogg http://vorbis.nm.cbc.ca/cbcr1-toronto.ogg
(see The Unix Prog Env. for a similar 'timeout')
I got a 36s segment OGG file. It appears that some history is captured
in the stream also.
Could you break your shows into segments shorter than 1h, if 1h
is a problem?
I hadn't heard of 'mmsrip'. That seems to be a good tool.
I haven't done much capturing, but I have used VLC (gui based), or this:
mplayer.exe -dumpstream mms://somehost.com/somedirectory/somefile.wmv
For the record, when I tried this:
mmsrip --delay=15 --output=cbc01.wma mms://wm.cbc.ca/cbcr1-toronto
I got a 15s wma file. There may be about 0.5s of history.
> - I often want to record something that I found out about by coming in
> on the middle. In these cases, it is great to capture from a
> station in a later timezone.
Why rely on alternate timezones which are arbitrary, instead of
a general solution?
Why not set up a daemon to capture the stream every N minutes,
along with some cleanup routines?
My example:
## 5m capture example:
while true; do
stamp=`/bin/date -u +'%Y%m%dT%H%M%SZ'`
mmsrip --delay=300 --output=cbc01.$stamp.wma \
mms://wm.cbc.ca/cbcr1-toronto
done
> The output of mmsrip, at least in this case, is a .wma file. But it
> is a bit malformed: it won't work in my mp3 players. Two things do
> understand it:
>
> - ffmpeg
>
> - mplayer (because it uses the ffmpeg library)
>
> It turns out that a null transcoding by ffmpeg can make the file work
> with my Creative Zen V! ffmpeg has unconventional flags -- check the
> manpage.
>
> ffmpeg -i captured.wma -acodec copy nice.wma
Why bother with WMA format at all? I had a player from several
years ago that played WMA files. It does not play today's WMA files.
Convert it to MP3, so it will work in ALL MP3 players.
I know, the quality suffers slightly converting lossy to lossy,
but this is not high fidelity music we are talking about.
I tried this:
$ ffmpeg -i cbc01.wma cbc01.mp3
$ file cbc01.mp3
cbc01.mp3: MPEG ADTS, layer II, v1, 64 kBits, 44.1 kHz, Monaural
Unfortunately, it produced an MP2 file, not MP3.
I am not sure what is wrong. MP2 is similar,
but may not be supported on all MP3 players.
Then I tried it in two steps; to WAV then to MP3:
$ mplayer cbc01.wma -ao pcm:file=cbc01.wav
$ lame cbc01.wav # LAME 32bits version 3.97; produces cbc01.wav.mp3
$ file cbc01.wav.mp3
cbc01.wav.mp3: MPEG ADTS, layer III, v1, 64 kBits, 44.1 kHz, Monaural
I listened to cbc01.mp3 and cbc01.wav.mp3 and did not notice any
difference in quality.
BTW, I encode music at 192 kbps cbr, and speech at 64 kbps cbr.
***
Other Notes:
I choose a 5m interval for files, which turned out to be convenient
for quickly accessing what I want to keep, by just hitting
the ">>|" button in VLC.
Also, I don't like MP3 files longer than 10m because
many MP3 players do not have a "very very fast-forward", nor
a rewind into the end of the previous track.
About your player:
You have a "Creative Zen V". I used to have a "Creative Muvo 2GB White"
and it was one of the worst I have had; I had to return it.
Here is a list of the problems from my notes which may or may not
be relevant in your case:
- will freeze up if there are symbolic links or shortcuts
- will not play files deeper than 3 folder levels
- that is unacceptable
- must use predefined root folders
- no way to skip current folder, except by skipping tracks
or going to the menu and choosing skip folder
(problem is that it doesn't keep track of where you were)
- skipping folder always starts at the root of the default folder
- pops and clicks were heard randomly, about 6 per hour
(confirmed as systemic on some web forums)
--
Eric Battersby.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list