Recording streamed media

Sometimes you want to be able to download a file that is offered on a website as a stream. For instance if you want to watch or listen to the file when you’re not online. Or, if you are afraid that the stream will be removed from the site. Using MPlayer you can download any streamed file that is supported by this program.
Example:

mplayer -cache 2000 -dumpstream ‘mms://wm.stream1.fsw.leidenuniv.nl/law/jeroen_ski_test.asf’ -dumpfile my_recording.wmv

The stream, in this example mms://wm.stream1.fsw.leidenuniv.nl/law/jeroen_ski_test.asf, is dumped to the local filesystem as my-recording.wmv. This process does not affect the media encoding. This means that if the original streamed file is a Windows Media file, so is the dumped version. You can also record media files that are served from a regular webserver.
E.g.

mplayer -cache 2000 -dumpstream http://fredrik.hubbe.net/plugger/test.mpg -dumpfile my_recording.wmv

Nb. the single quotes around the stream location ensure that an URL that contains whitespaces will be parsed properly.

Sometimes it’s hard to find the URL of the stream you want to record. Luckely the lovely MPlayerplugin allows you to save the URL of the file you are watching in your browser. A more dramatic way to discover the URL the mediaplayer is playing is to sniff your network traffic for stream URL’s. For example by using StreamSniff.

Note: respect copyright restrictions that may apply to the stream you want to record.

Leave a Reply