Sunday, June 24, 2007

Saving a Streaming MSDN Showtime video to your local drive

Class is in Session

As I have been mentioning, I've been leading a class at work for some of our newly-hired desktop support trainees.

The bulk of material presented was developed and written by me along with additional material provided from various network analysts across the state.

However, I wanted to seed the materials with a few additional technical videos from the Microsoft ITsShowtime website:

Specifically, I found these two presentations by Mark Russinovich to be highly useful in showing how to approach a malware infection and use the Process Explorer tool from Microsoft's Sysinternals.

Only I had a little problem...I didn't want to show them as streaming videos.

Rules, Rules, Rules

We generally forbid employees from downloading any video or music streams at work. That is clear policy. Although we run high-bandwidth pipes at our office locations, the impact of a few users running streaming media can quickly and negatively impact our network performance. And, with the exception of training videos or the rare live-webcam conferences by a few executives, there really isn't any justifiable business need for it.

Now I know I have authorization to do so, but I still knew that the network at headquarters would take a hit anyway and just wanted to be considerate to the other customers.

What could I do?

Could I figure out how to save the stream off hours (or at home) and play it back locally instead of as a streaming media file?

The Hunt is On!

It took me a while, but I eventually found this great post by Roy Osherove at his ISerializable blog that gave me hope: How to save a streaming MSDN Showtime video locally.

In the post comments he was instructed to use the freeware application VLC media player to capture the WMP (Windows Media Player) stream link and save the file locally.

But first you need to find the actual path to the ASF URL. Luckily for Roy, a poster gave him the link in the comments. However, it indicated that if you could capture and examine an ASX file that (should) download to the cache, you can just pick the stream URL out of there.

So on my XP Pro system, running WMP 11, I emptied my IE cache and fired up the stream. Sure enough, there was the file in my cache and a quick view in notepad revealed the target URL!

Golden!

Now, since I would have to capture the stream outside of "production" hours at work to avoid impact on our bandwidth, I decided just to repeat the process at home and capture them there.

Only when I tried it on my Vista and XP Home systems...I never could locate the ASX file. I'm still not sure why.

So it looked like I would just have to do the download at work.

Back to the Books!

I did some more research in the meantime on the protocol for this streaming file and came up with the following interesting leads:

Based on this, I wondered if I could capture the URL I was looking for with a packet sniffer. Maybe I could get lucky and locate the true target streaming URL that way?

Target Sniffed and Snagged x3!

(Note...see update at end of post for simpler method of URL capture.)

At work, I fired up Wireshark and began a fresh capture before clicking on the link to play the target video (in this case "Advanced Malware Cleaning").

Once it began playing, I stopped the capture and culled through the packets. Sure enough, after a bit of time I found several versions of what I was looking for. Only it took a considerable amount of time and work picking though the details to locate and extract the address.

So I tried some other packet sniffers I use.

Next I used NirSoft's SmartSniff application. Fired up a capture, hit "play" on the video and after a few moments stopped the capture and video.

This interface worked much easier for what I needed. I quickly captured the ASX file packet information and in it found the mms:\\ protocol line that had my target URL address for VLC!

mms://a2.v148539.c14853.g.vm.akamaistream.net/5/2/14853/v003/<snip>/0369_w.asf

In another packet also saw a RTSP protocol URL and decided to give that a try as well as it also otherwise had the same file URL.

rtsp://a2.v148539.c14853.g.vm.akamaistream.net/5/2/14853/v003/<snip>/0369_w.asf

(NOTE: I've snipped the actual URL here to get them to fit in my blog. I really don't want to list the actual links as they may be subject to change. Following the techniques listed should get you the "true" URLs without much fuss....keep reading!)

Finally I wanted to see how AnalogX's PacketMon would work:

Checking each packet captured one at a time was pretty tedious again.

So I set a new group, and then two rules to capture only all those those packets that contained "RTSP" or "MMS" strings.

Then I started the packet capture and fired up the video for streaming.

Only a handful of packets now were captured for me to quickly pick through.

I opened up the detail view and set the view to "Display as text only."

In no time at all I had picked up the target MMS and RTSP URL. Either should work fine.

I found NirSoft's SmartSniff to be the easiest to quickly use and get what I needed, but AnalogX's PacketMon actually did a more targeted job of filtering with just a little setup work. Pick your own medicine.

Validation of URLs

So I copied each of the two ITsShowtime MMS/RTSP url's to a text file for safe keeping. I then opened up IE and launched the URL to see if it would work.

Bingo! Like a charm!

Same held true for opening the link in WMP directly.

Stage Two--Capturing the Stream

I knew from Roy's post that it was recommended he use the VLC media player to do the streaming capture.

I downloaded and tried it and found it would do the job...but seemed kinda clumsy and limited for my purposes.

Was there a better way?

Amazingly there was!

SDP ROCKS!

From one of the links mentioned earlier I discovered a little (freeware) application called SDP: The SDP Multimedia website for ASF download and MMS protocol specification.

Simply Amazing!

(SDP Screenshot)

Besides MMS, SDP allows you download and capture the following protocols: Http v1.0 streaming protocol, Http progressive (simple http download) and of course: mms, mmst and mmsu over both TCP and UDP transport protocols. The current version of SDP 2 does not support RTSP streaming.

Near the bottom of the main page are additional protocol documents if you are so inclined.

I wasn't worried as my packet captures found that the URL for both the MMS and RTSP streams were were same.

It's GUI isn't the prettiest but it does the trick.

SDP developers have done a highly commendable job of providing a clear and well illustrated SDP Read-Me page. It took me a few minutes of quick reading and I was good to go.

What is more, SDP has a "VCR" mode so you can configure it to run and capture a steam at a preset time, fantastic to capture video streams outside of "production" or high-volume periods...say at night.

The network performance monitor is handy as well.

I followed the steps needed to set and being the stream capture and turned it loose. As each video was just over an hour in length, it isn't a fast process, but it worked like a charm.

When done I had both ITsShowtime video's fully downloaded in their entirety to my hard drive. I was able to fit them both on a single CD-ROM disk to take back to work.

It is Showtime!

For playback there are many media player options.

If you have a version of Windows Media Player already installed, you should just be able to double-click the file and the video will play-back automatically.

VLC media player handed the files just fine as well for nice playback.

Finally, I really like using MPUI, the MPlayer frontend for Windows. This is a tiny (and portable) application for media file playback.

Take your pick or use your own if it is compatible.

Anyway, all three of these played the file back just perfectly for me.

So there you go. I can't say this is an easy process to do, but it is by no means difficult for the moderately experienced techie or system administrator to do. I'm pretty sure this technique might be extendable to some other streaming media formats as well.

Is it Legal?

Note, I am not a lawyer....

So, how does Microsoft feel about off-line download and viewing of the ITsShowtime videos?

I couldn't find anywhere specific that they forbid it. I'm clearly not interested in reposting, redistributing, or restreaming the files myself and am using them only to promote and train users in the Microsoft products. I couldn't imagine that would be a bad thing.

I did find this one link on their ITsShowtime FAQ page that gives me confidence:

How do I convert the downloaded video to play it on my DVD-Video player?

Use your favorite DVD authoring software to import the WMV file and the included optional subtitles. You can then burn the converted video and subtitles to a DVD disc and play it on your standalone DVD player.

Too bad they didn't explain how to "import the WMV file" anywhere to begin with.

Would have save me a lot of time in needing to write this post!

--Claus

Update: 06-25-07

Commenter Nicholas suggested using the Firefox extension Download Helper to get the URL. I hadn't heard of this one, so I installed it and gave it a shot. Once installed I logged into ITsShowtime and started the video. I then clicked the little icon for Download Helper in my toolbar and it now showed a .asp entry. I selected it, then saved the file to my local drive. Finally I opened the downloaded .asp file and, voilla, just as Nicholas suggested, there was the mms URL link to video stream. It has a lot more media download helper support as well.

Much easier and quicker method, indeed! With that in hand, you can then download the file via SDP.

I also noticed that while the VLC media player could play the downloaded file directly, the MPUI player would not without first downloading additional codecs. I then found that another freeware 3rd-party media player could also handle the downloaded file immediately: KMPlayer. So you might want to give this little guy a try as well. It has a lot of really great features for media playback.

Thanks Nicholas for the tip!

2 comments:

mingxhin said...

It would be much simpler to use the Firefox extension DownloadHelper.
It immediately detected the .asp file and from there you can save it and open in notepad to extract the streaming link.

Anonymous said...

Nicholas,

your suggestion is absolutely brilliant!

I just tried it and it worked like a charm.

Wish I had known this before!

I'll do an update to this post later this week with your suggestion.

Thanks!