Sun Jul 26 07:45:54 PDT 2015

How to Capture an RSTP Streams

A while back I found myself wanting to make a permanent copy of a talk given on the web using an rstp address. You might want to do this to be able to share the talk with a friend or colleague - or to view later offline from the web. Here is how this objective can be achieved. The first step is discover the rstp address of the file. This is a little painful - but should always be possible. What worked for me was to launch the talk in a browser (which on windows fired up the Real Player embedded in the browser). This gave me an option to launch the Real Player browser, and this in turn gave me the option to share the presentation with a friend using email. I took this option - and finally ended up with an email message which revealed the rstp://... information required to capture the file. This looks like an http:// address - but to grab the file you need a program that can talk rstp:// - so wget etc. cannot be used. MPlayer does have the requisite functionality though, here is the command line to capture the file:

mplayer -noframedrop -dumpfile example.rm \
-dumpstream rtsp://"long complicated address/filename.rm"

Then you need to convert the captured example.rm file to wav format:

mplayer -ao pcm example.rm

And initially mplayer failed with 'Cannot find codec for audio format 0x72706973' for me - that was a little tedious - but it was cured by returning to the official Mplayer [6]site and just putting the sipr*.dll (from the codecs zip file) in the Mplayer directory. So finally:

mplayer -ao pcm example.rm

...created 'audiodump.wav' which lame was able to turn into a mp3 file as required, and:

lame -h audiodump.wav example.mp3

Creates an mp3 file. So, it takes a few steps - but eventually you get the offline usable mp3 file.

Further notes on this topic:

Again I faced the question of off-line mp3 listening. Specifically, how to listen to a online news item from NPR - when I am constantly interrupted when I am online and would prefer something that I can listen to on my mp3 player or ipod shuffle. As the [5]rstp post indicates the main problem is determining the rstp address of the media source. Here is how to determine this for the NPR site.

1) Start up a browser listening to the interview or show that you would like to listen to off-line. (I used Firefox). This will spawn a 'player' browser window with the embedded control for the Windows Media Play or Real player within it.

2) Use the 'Launch Standalone Player' to fire up the Real player in isolation (switch to Real player if necessary)

3) This has the effect of downloading a 'rpm' file to your desktop - this file contains a url like this:

http://www.npr.org/templates/dmg/dmg_em.p....

4) Actually, this string is (deliberately?) very long and complex - and you need to turn this into an rstp address. Do this using

wget -O output.txt "http://www.npr.org/templates/dmg/dmg_em.p...."

I did this by just editing the rpm file, then typing:

source filename.rpm

Note that some additional quotes needed to be added to the http address.

5) This wget operation is fast - and you will find in the output.txt file an rstp address that can be fed into the instructions for capturing an [6]rstp stream as an mp3 file.

Once you have determined the necessary steps for a given site, you can script them, and if appropriate have them happen using a crontab on an automated basis.


Posted by ZFS | Permanent link | File under: bash