Downloading a Flash video stream under Linux with rtmpdump: Finding the RTMP URL
Version: 1.0 (4/Nov/2010)
The first thing you need to find out is the RTMP URL of the video that you want to save - beware, we are talking of a special URL to which the Flash application connects, and not of the URL of the page where the video is embedded in.
An RTMP URL has the following form:
rtmp://videoserver/application/filepath
In some rare cases there may also be a port number - RTMP connects by default to port 1935, but the server may be using another port. In this case, the port number has to be added after the videoserver:
rtmp://videoserver:port/application/filepath
So you must look for something like that; a good place to start is the source code of the page which contains the embedded video. Often there are pieces of javascript code where this information is stored; in some cases, javascript may be used to select one of many videos to be shown in the embedded window. Sometimes the different pieces - the video server name, the application name and the file path (and maybe the port) - will be stored in separate places. Sometimes there will be a variable holding all of the URL except the file.
Another, even better, source - if available - is the "embed code": if the website offers you to copy and paste a piece of HTML code to allow you to embed their videos in your website, you'd better pick it up and examine it carefully. It is very likely that the pieces of information you are looking for will be in there somewhere.
Fortunately, most websites streaming video on their own use the same Flash application for playing, named JWPlayer, and will offer you an embed code made like this (the example actually comes from a United Nations website):
<embed src='http://webcast.intgovforum.org/swfs/player.swf' height='494' width='640' allowscriptaccess='always' allowfullscreen= 'true' flashvars="&aboutlink=http%3A%2F%2Fwww.un.org%2Fwebcast%2F& abouttext=United%20Nations%20Webcast&autostart=true&bandwidth=378& dock=false&file=igf%2F2010%2FPlenary%2FEnglish%2F20100917%2FPL-E- 20100917-1500-F.flv&level=0&plugins=viral-2d&streamer= rtmp%3A%2F%2Fwebcast-flash.un.org%2Fondemand%2F&type=rtmp"/>
Noticed anything? No, not the src URL: that is the HTTP URL where the Flash application itself can be downloaded by the browser. But the flashvars parameter holds a whole series of variables and values, in the form
&variablename=value&variablename=value...
All values are URL-encoded, which means that special characters have been replaced with a %xx sequence, where xx is the hexadecimal representation of the ASCII code of the character. If that's too complex for you, just replace %20 with a space, %2F with / and %3A with :. This is what you get:
&aboutlink=http://www.un.org/webcast/&abouttext= United Nations Webcast&autostart=true&bandwidth=378&dock=false&file= igf/2010/Plenary/English/20100917/PL-E-20100917-1500-F.flv&level=0& plugins=viral-2d&streamer=rtmp://webcast-flash.un.org/ondemand/& type=rtmp
Now things should be clear: the streamer variable holds the first part of your RTMP URL, up to the application included, and the file variable contains the rest of the URL. So the RTMP URL of your video is (all on one line):
rtmp://webcast-flash.un.org/ondemand/igf/2010/Plenary/ English/20100917/PL-E-20100917-1500-F.flv
Easy, isn't it?