View Single Post
  #6  
Old 06-26-2010, 12:44 AM
Ed999 Ed999 is offline
Senior Member
 
Join Date: Feb 2009
Posts: 115
Ed999 is on a distinguished road
Default

How to (correctly!) use rtmpdump, rtmpsrv


The program RTMPSRV.exe (which accompanies RTMPDUMP.exe in most Windows distributions) can 'sniff' the connection and find the necessary settings for you.

Instructions on how to use it are included with it in most distributions. But here's a more detailed set of instructions -


All you really need is the HOST address of the RTMP file you want to download. Then go through the steps below. For example, this is the BBC iPlayer's host address:

bbcmedia.fcod.llnwd.net

The HOST address is the part of the rtmp URL at the very beginning. It's really the server's address. Example -

rtmp://bbcmedia.fcod.llnwd.net/ondemand?...


1. Download the programs RTMPDUMP v2.1d and RTMPSRV v2.1d (filename: rtmpdump-2.1d-windows.zip) with this link:

http://rtmpdump.mplayerhq.hu/downloa...1d-windows.zip

Extract both those programs from the zip file into the same folder.

You may find that this version of the programs works on YOUR version of Windows, because v2.1d will even work on Windows98! (Or run it on Windows 98: you being a savvy Windows 7 user will know how to run Windows 98 in a virtual machine inside Windows 7.)


2. Edit your computer's HOSTS file, as follows (these instructions are for Windows 98, and you'll need to modify them to point to the ATTRIB.EXE and HOSTS files if you have Windows XP/Vista/7):

(a) Go to START > RUN and type the following in the box, then click OK:

c:\windows\command\attrib.exe -R -S -H c:\windows\hosts

(b) Go to START > RUN and type the following in the box, then click OK:

edit c:\windows\hosts

(c) Disable the line in the HOSTS file that reads
127.0.0.1 localhost by putting a # at the start of that line

(d) Type a new line, immediately underneath that line, giving the host address of the RTMP file you want to download. Example:

127.0.0.1 bbcmedia.fcod.llnwd.net

(e) Save the changes: File > Save


3. Run RTMPSRV.exe by double-clicking it. Only then do you start the Flash stream playing, in the webpage that streams it (RTMPSRV.exe must already be running), and look at the window in which RTMPSRV is running: it will start displaying the true RTMP address of the file that's playing, outputting in fact the command string to download it!

Typically you'll see something like this -

rtmpdump -r "rtmp://[server]:[port]/[application]?[authString]"
-a "[application]?[authString]" -f "[Flash Version]" -W "[swfUrl]"
-p "[iPlayer page URL]" -y "[mp4: to .mp4 playpath]" -o file.flv


That will be displayed every couple of seconds, as each incoming packet is sniffed and analysed. But you only need the first one. So stop the RTMPSRV program after the first couple of packets have gone through. A few seconds will see this through.

Of course the easy way to save that vital command string is to write a batch file to run RTMPSRV.exe and pipe its output to a second .BAT file that will handle the actual download. The batch file must be one line, as follows:

rtmpsrv > download.bat

If you double-click that batch file, it will save all its output into DOWNLOAD.bat and all you need do (in theory) is run DOWNLOAD.bat to start the download! But first -

A. DOWNLOAD.bat must be in the same folder as RTMPDUMP.exe and RTMPSRV.exe

B. You must have an open Internet connection running.

C. You must re-edit your HOSTS file back to its original state (otherwise you'll simply get an error message).

D. There will be many copies of the download command saved into the batch file DOWNLOAD.bat, so you must edit it to delete all but one of them! Otherwise the batch file will keep deleting (overwriting) the download - every time it completes it!
Reply With Quote