Discussion:
Capturing an rstp, mms or ogg audio stream and coverting to MP3
Eric Dunbar
2005-04-03 00:45:39 UTC
Permalink
Hello all: I have a challenge for you.

I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.

<preamble>
The Canadian Broadcasting Corporation (CBC) is the public Canadian TV
and radio broadcaster that is an analogue to BBC in the UK or NPR in
the US.

I'd like to listen to some of the programs made by the CBC at my
leisure on an MP3 player. Unfortunately, CBC doesn't exactly get how
MP3s could be *increase* listener numbers and expand audiences,
especially amonst the (mostly) younger iPod-toting crowd (this is the
demographic they are having trouble reaching) and the CBC has only
taken baby steps in getting their audio content on-line.

To their credit, do provide archives for some of the programs (for
which they own copyright) on-line in streamed RealPlayer format (e.g.
<rtsp://media.cbc.ca/cbc.ca/thehouse/media/latest-thehouse.rm>), and,
they also provide live feeds in Windows Media Player format and now
have an experiment going with live streamed OGG (see
<http://www.cbc.ca/listen/ogg.html>).

(I'm still fuming that they dropped QuickTime format supported by
iTunes and went with the vastly inferior WMP but that's a different
story)
</preamble>

So, in a nut-shell, I have two major options to get audio from the
web: streamed OGG for live broadcasts and streamed RTSP (RealPlayer)
for audio-archives.

I'd like to capture the bit-stream for both formats (OGG and RTSP) and
convert them to MP3 or AAC for playback on an MP3 player (which I have
yet to get... chances are it'll be an iPod shuffle 512 MB, but if
there any *good* ones out there that support OGG I might consider them
instead).

(1) OGG

I have a hunch that it'll be possible to do it for OGG format since I
can actually DOWNLOAD the file using wget and any web browser (e.g.
<http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg> as referenced in
<http://www.cbc.ca/livemedia/cbcr1-toronto.m3u>) directly to disk.

I suspect that I could create a cron entry (anacron would be pointless
for *live* content ;-) that did:
wget http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg
at a certain time (e.g. 21:05), and, then at the end of the program
(21:59) would run another cron along the lines of:
killall wget

I also suspect there are some apps out there that can be coaxed into
automagically converting OGG into MP3 or AAC format (if I can find any
OGG plug-ins for iTunes I could use the magic of Unix under OS X).

(2) RTSP or WMP

This is where I'm not entirely sure what to do. Since the archives are
streamed in an RTSP format that I cannot download directly to file
with wget or another web browser I'm stumped as to what to do. ASX
format for WMP is just as much an enigma -- I don't know how to get
<mms://wm05.nm.cbc.ca/cbcr1-toronto> into a file directly.

Also, neither format play nicely on either YellowDogLinux or Ubuntu
(WMP is not supported on PPC and I have yet to get the
RealPlayer/Totem application to play anything without complaining
about unsupported format).

Any thoughts? Anyone else have any success doing something similar?

Thanks, Eric.
Brian Dunnette
2005-04-03 02:14:13 UTC
Permalink
Eric-

For RealPlayer streams, check out vsound, which takes the output from a
program and dumps it to a wav file, which you can then convert to
whatever format you like... it's available in universe.

-Brian D.
Post by Eric Dunbar
Hello all: I have a challenge for you.
I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.
<preamble>
The Canadian Broadcasting Corporation (CBC) is the public Canadian TV
and radio broadcaster that is an analogue to BBC in the UK or NPR in
the US.
I'd like to listen to some of the programs made by the CBC at my
leisure on an MP3 player. Unfortunately, CBC doesn't exactly get how
MP3s could be *increase* listener numbers and expand audiences,
especially amonst the (mostly) younger iPod-toting crowd (this is the
demographic they are having trouble reaching) and the CBC has only
taken baby steps in getting their audio content on-line.
To their credit, do provide archives for some of the programs (for
which they own copyright) on-line in streamed RealPlayer format (e.g.
<rtsp://media.cbc.ca/cbc.ca/thehouse/media/latest-thehouse.rm>), and,
they also provide live feeds in Windows Media Player format and now
have an experiment going with live streamed OGG (see
<http://www.cbc.ca/listen/ogg.html>).
(I'm still fuming that they dropped QuickTime format supported by
iTunes and went with the vastly inferior WMP but that's a different
story)
</preamble>
So, in a nut-shell, I have two major options to get audio from the
web: streamed OGG for live broadcasts and streamed RTSP (RealPlayer)
for audio-archives.
I'd like to capture the bit-stream for both formats (OGG and RTSP) and
convert them to MP3 or AAC for playback on an MP3 player (which I have
yet to get... chances are it'll be an iPod shuffle 512 MB, but if
there any *good* ones out there that support OGG I might consider them
instead).
(1) OGG
I have a hunch that it'll be possible to do it for OGG format since I
can actually DOWNLOAD the file using wget and any web browser (e.g.
<http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg> as referenced in
<http://www.cbc.ca/livemedia/cbcr1-toronto.m3u>) directly to disk.
I suspect that I could create a cron entry (anacron would be pointless
wget http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg
at a certain time (e.g. 21:05), and, then at the end of the program
killall wget
I also suspect there are some apps out there that can be coaxed into
automagically converting OGG into MP3 or AAC format (if I can find any
OGG plug-ins for iTunes I could use the magic of Unix under OS X).
(2) RTSP or WMP
This is where I'm not entirely sure what to do. Since the archives are
streamed in an RTSP format that I cannot download directly to file
with wget or another web browser I'm stumped as to what to do. ASX
format for WMP is just as much an enigma -- I don't know how to get
<mms://wm05.nm.cbc.ca/cbcr1-toronto> into a file directly.
Also, neither format play nicely on either YellowDogLinux or Ubuntu
(WMP is not supported on PPC and I have yet to get the
RealPlayer/Totem application to play anything without complaining
about unsupported format).
Any thoughts? Anyone else have any success doing something similar?
Thanks, Eric.
occy8
2005-04-03 02:53:28 UTC
Permalink
I use the sound recorder. In the volume control you need to get the
settings to capture the sound from the sound card.
You can save it as wav, ogg or I think mp3 it says record as and then
cd quality or voice. That is the format.
My recording meter doesn't work for some reason, so it needs some
fiddling, but it does work. Also the quality is not as good as if you
use eac in windows, but for voice it should be fine.
--
occy8
Sami Haahtinen
2005-04-03 09:24:38 UTC
Permalink
Post by Eric Dunbar
I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.
A quickie would be to install gstreamer0.8-lame
(http://www.ubuntulinux.org/wiki/RestrictedFormats) and using gstreamer
to convert any stream supported by gstreamer to mp3.

gst-launch-0.8 gnomevfssrc \
location=http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg ! decodebin ! \
lame ! filesink location=test.mp3

Simple, yet effective. Same can be done with the faac plugin for
gstreamer to make AAC files.

- S
Oliver Grawert
2005-04-03 10:04:48 UTC
Permalink
hi,
Post by Eric Dunbar
Hello all: I have a challenge for you.
I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.
have a look at streamtuner and streamripper

ciao
oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050403/66530d39/attachment.pgp>
agger
2005-08-14 12:32:11 UTC
Permalink
Post by Oliver Grawert
hi,
Post by Eric Dunbar
Hello all: I have a challenge for you.
I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.
have a look at streamtuner and streamripper
ciao
oli
I need to download an RTSP stream in RealAudio VIDEO format to

a file (I don't care which format).



How would I do this? I tried streamripper, but it told me that:

-----------------------

agger at ganesh:~$ streamripper http://tinyurl.com/9b2p3

Warning: splitpoint sanity check not yet complete.

Connecting...



error -54 [SR_ERROR_NOT_SHOUTCAST_STREAM]

bye..

shutting down

-----------------------



which I take to mean that streamripper only supports audio format; do
you know of any tool that might do the same to RTSP video streams?



thanks very much in advance,



Carsten Agger
--
agger
Larry Grover
2005-08-14 14:54:22 UTC
Permalink
Post by agger
I need to download an RTSP stream in RealAudio VIDEO format to
a file (I don't care which format).
-----------------------
agger at ganesh:~$ streamripper http://tinyurl.com/9b2p3
Warning: splitpoint sanity check not yet complete.
Connecting...
error -54 [SR_ERROR_NOT_SHOUTCAST_STREAM]
bye..
shutting down
I recommend you use the "mplayer" program to do this.

Your URL, http://tinyurl.com/9b2p3, returns a file (media.ram)
containing a single line with a rtsp:// URL. To capture this stream
you can use the rtsp URL with mplayer and the -dumpstream option. At
the commmand line you should type (should be one long line, but will
probably be wrapped in the email):

mplayer -dumpstream
rtsp://www.superchannel.org:554/Channels/SITFLEX/MirrorheadTV/InterviewmedCarstenAgger.rm

When mplayer is done retrieving the stream you will have a file called
stream.dump. The format of the file (stream.dump) will the the same
as the original stream. In this case, real media.

If you want, you can change the name of your file:

mv stream.dump InterviewmedCarstenAgger.rm

Regards,
Larry
agger
2005-09-20 17:49:30 UTC
Permalink
[color=blue]
Post by agger
I need to download an RTSP stream in RealAudio VIDEO format to
a file (I don't care which format).
-----------------------
mplayer -dumpstream
rtsp://www.superchannel.org:554/Channels/SITFLEX/MirrorheadTV/InterviewmedCarstenAgger.rm
When mplayer is done retrieving the stream you will have a file called
stream.dump. The format of the file (stream.dump) will the the same
as the original stream. In this case, real media.
mv stream.dump InterviewmedCarstenAgger.rm
Thanks a lot!



Just a stupid side question; I find the man page for mplayer rather
confusing. Can

I dump a stream and have it play in the GUI at the same time?
--
agger
Eric Dunbar
2005-09-21 03:12:36 UTC
Permalink
Agger,

I suspect that you can name the stream using mplayer so you won't have
to do the mv command.

As for listening to file at the same time... I don't see why not since
it's a stream (encoded to be listed to as it comes in). You may be
able to open the file stream.dump directly and have the GUI player
automagically recognise the file, or you could create a link to the
file:

ln stream.dump file.rm

Eric.
Post by agger
[color=blue]
Post by agger
I need to download an RTSP stream in RealAudio VIDEO format to
a file (I don't care which format).
-----------------------
mplayer -dumpstream
rtsp://www.superchannel.org:554/Channels/SITFLEX/MirrorheadTV/InterviewmedCarstenAgger.rm
When mplayer is done retrieving the stream you will have a file called
stream.dump. The format of the file (stream.dump) will the the same
as the original stream. In this case, real media.
mv stream.dump InterviewmedCarstenAgger.rm
Thanks a lot!
Just a stupid side question; I find the man page for mplayer rather
confusing. Can I dump a stream and have it play in the GUI at the same time?
--
agger
Edward The Bonobo
2006-04-19 10:19:50 UTC
Permalink
It's dazzlingly simple with Vsound/Sox and Lame. This excellent article
explains how:
http://www.linux-magazine.com/issue/57/Ripping_Audio_Streams.pdf
--
Edward The Bonobo
Eric Dunbar
2005-04-04 02:28:13 UTC
Permalink
On Apr 3, 2005 6:12 PM, Daniel Gimpelevich
http://sourceforge.net/project/showfiles.php?group_id=41359
Convert OGG to MP3 with oggdec followed by LAME.
It wasn't working with iTunes when I tried it a few days ago, but, I
also didn't try very hard since vlc worked flawlessly.
Post by Eric Dunbar
I also suspect there are some apps out there that can be coaxed into
automagically converting OGG into MP3 or AAC format (if I can find any
OGG plug-ins for iTunes I could use the magic of Unix under OS X).
I'm not at the auto-conversion stage of things yet (doing this on my
YDL box) but I have two issues in this e-mail...

#1 I am trying to create a script for a cron job to automagically
download a stream file and need some help stopping/killing the
process.

I will run the script ideas-download at 21:00 and would like to stop
stream capture at 22:00. It is the script that'll run at 22:00 that
isn't quite "perfect" (it works for all practical purposes but I'd
like it to be "clean"):

Right now I use wget to download the stream and "killall wget" to kill
the d/l. Instead, I'd like to grab the PID for the *right* wget
process and kill it (in case, for some strange reason, I may want to
have more than one wget active at a time).

One problem I see is that "ps -fe |grep "wget http://ogg" ALSO picks
up the grep process. The other problem that I have is that I'm not
sure how to extract the PID, even if I can pick up the right process.

As an alternate solution, is there perhaps a way to write the PID of
the wget process to disk or an environment variable when wget is
launched so that I can use the PID later in the second script to
"kill" the wget at 10:00 pm?

#2 I have to figure out how to insert these scripts into the cron
schedule "properly" (I can do it with WebMin but should, I suppose,
learn how to do it "right" as well (just in case)):

Script #1, ideas-download:
#!/bin/bash
Date=$(date +%Y.%m.%d)
URL="http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg"

wget $URL -O CBC-Radio-Ideas--$Date

Script #2, stop-ideas-download
#!/bin/bash
killall wget

PS YellowDoggers ... I've tried playing some of the d/l ogg file in
the players included in 4.0 but keep getting complaints about the
audio device being unavailable. Does this have something to do with
the audio problems that are known to dog "the 4.0 Y'dog"? (I do get
the test sound in the Soundcard detection tool)

Sincerely, Eric
Eric Dunbar
2005-05-01 15:44:22 UTC
Permalink
[Note: this was part of an earlier thread... I'm going to experiment
with Chris Kastorff's suggetions re: kill next]

Goal: I wanted to capture radio shows from CBC radio 1*, encode them
to MP3 and then listen to them at my leisure on my iPod Shuffle.

*Canadian Broadcasting Corporation, the Canadian BBC or NPR .

Since I've gotten this thing working I've been able to listen to a LOT
more programs that I want to listen to WHEN I want to listen to them
than I used to....

the good ones (IMNSHO) are on at times when I don't really listen to
radio, e.g. Ideas 21-22 EST (-05:00 EST) <http://www.cbc.ca/ideas/>
which is a one hour program on a specific topic from anything on
science-politics-religion-philosophy-children's lit-the kitchen
sink-art-etc (they had a show on Hans Christian Anderson and on the
monarch butterfly (very good episode IMO) for e.g.)

Synopsis of problem: I wanted to pipe an .ogg stream from a wget
download to an .ogg to .wav decoder to a .wav to .mp3 encoder

(FYI ogg is similar to the mp3 file format (compressed) and .wav is
uncompressed audio)

Solution: even simpler than I thought (will work on Linux and under OS X):

ogg123 -d wav -f - http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg|lame
- outfile.mp3

This line uses ogg123 to connect to CBC's server, download their live
ogg stream and then pipe it to lame (an mp3 encoder/decoder) to encode
to MP3. Lame and ogg123 play together very nicely. When lame's stdin
input is empty it waits for something to come in and continues
encoding :) :) :-)

This is a LOT cleaner than what I was doing up to today (using various
scripts and cron jobs):
1. download stream to .ogg file using wget (2nd cron job killall wget
at a certain time)
2. convert all .ogg to .wav in one dir using oggdec (quite fast) and
rm -f all the ogg
3. convert all .wav to .mp3 using lame and rm -f all the wav

I tried piping wget to oggdec to lame but couldn't get past oggdec...
rather than pipe to lame oggdec would write to the file -.wav (which
was a pain to delete from the command line... I ended up using
nautilus or OS X Finder (logged in via SMB))

This is what I tried (unsuccessfully):
wget http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg -O -|oggdec -|lame
- outfile.mp3

(FYI I tried oggdec -, oggdec - -, oggdec, all to no avail)

PS I can't get lame to do the ogg-to-mp3 conversion directly (I
compiled from source with the --with-vorbis flag enabled but couldn't
figure out how to get ogg->mp3... doesn't matter b/c ogg123->lame
works beautifully).

PS this post'll appear twice in response to two message threads I started!

PSS This is what my script looks like (so far it seems to be working
with cron... I set it to start on the top and bottom of the hour from
2100 to 2200 weekdays and 1000 to 1200 on Sundays):

#!/bin/bash
killall ogg123

Date=$(date +%Y%m%d.%H%M)
URL="http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg"
LPath="/home/erdunbar/"

/usr/bin/ogg123 -d wav -f - $URL|/usr/local/bin/lame - ${LPath}CBC-${Date}.mp3

Notes:
(1) I had to specify the path for lame b/c the cron tab entry didn't
run properly without. ogg123 would run but then the error message in
mail reported that lame couldn't be found.
(2) for newbies... you have to "chmod +x yourscriptname" to make your
script executable (you can run it manually from the command line by
typing ./yourscriptname after chmodding it).
(3) if you're interested in finding out what the flags mean, run man
ogg123 or man lame.
(4) I also run a cron tab "killall ogg123" to stop the final instance
of this script... I like 30 minute segments for listening purposes

Now... my next task is to get this machine to auto-update its time
(YellowDogLinux) b/c every week or so it slips by a minute or so.

Eric
cc:YDL General, Ubuntu-users, MUGLO
Short answer: Yes, just use a pipe (|) to do it
Long answer: Don't bother, just recompile LAME with Ogg input support
- its either an official compile option or theres a patch for it.
oggdec is slow (not that LAME doing it will be majorly), and there is
a possibility of pipe-starvation, where LAME could be running faster
than oggdec, and there wouldn't be any file to encode from...
Cian
Hi all,
I'm trying to use oggdec and lame to convert from .ogg to .mp3.
First I decode with oggdec to a .wav file and then from .wav to .mp3 using lame.
What I was wondering is if it'd be possible to direct the .wav output
from oggdec *directly* to lame, skipping the intermediate file
creation process?
You'll need curl (or wget), lame, the vorbis-tools (oggdec, oggenc,
ogg123, etc), and a decent userspace (including awk, sed, ps, etc) for
(you can replace "curl" with "wget -o -" if you want to)
shell$ curl http://mystream/ilike/radio.ogg | oggdec -o - - | lame
-q 2 --abr BITRATE - /path/to/stream/output.mp3
If this returns static, then try adding "-e 1" or "-e 0" between
"oggdec" and "-o".
shell$ ps axc | grep curl | grep -v grep | awk '{ print $1 }' |
xargs -n 1 kill
Or if you're on Linux and it's a seperate file/script, as in #!/bin/sh
blahblahblah,
shell$ ps axc | grep namofmyscript | awk '{ print $1 }' | xargs -n
1 kill
(The above will not work on Mach/OSX, for reasons better not explained
if you value your sanity.)
It's all just guesswork, because for some reason I can't load the
vorbis-tools nor can I load lame.
And by the way, I've tried numerous times to "copy" an r(s)tp/mms
stream and have had no luck at all with it.
-Chris Kastorff, aka `encryptio`
Hello all: I have a challenge for you.
I'd like to download streams of OGG and RealPlayer from a radio
station, convert them to MP3 or AAC (if I get an iPod shuffle), and
play them back on an MP3 player at my leisure.
So, in a nut-shell, I have two major options to get audio from the
web: streamed OGG for live broadcasts and streamed RTSP (RealPlayer)
for audio-archives.
I'd like to capture the bit-stream for both formats (OGG and RTSP) and
convert them to MP3 or AAC for playback on an MP3 player (which I have
yet to get... chances are it'll be an iPod shuffle 512 MB, but if
there any *good* ones out there that support OGG I might consider them
instead).
(1) OGG
I have a hunch that it'll be possible to do it for OGG format since I
can actually DOWNLOAD the file using wget and any web browser (e.g.
<http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg> as referenced in
<http://www.cbc.ca/livemedia/cbcr1-toronto.m3u>) directly to disk.
I suspect that I could create a cron entry (anacron would be pointless
wget http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg
at a certain time (e.g. 21:05), and, then at the end of the program
killall wget
I also suspect there are some apps out there that can be coaxed into
automagically converting OGG into MP3 or AAC format (if I can find any
OGG plug-ins for iTunes I could use the magic of Unix under OS X.
Any thoughts? Anyone else have any success doing something similar?
Thanks, Eric.
_______________________________________________
yellowdog-general mailing list
yellowdog-general at lists.terrasoftsolutions.com
http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
HINT: to Google archives, try '<keywords> site:terrasoftsolutions.com'
_______________________________________________
yellowdog-general mailing list
yellowdog-general at lists.terrasoftsolutions.com
http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
HINT: to Google archives, try '<keywords> site:terrasoftsolutions.com'
Loading...