Download Stanford SCPD streams (wmv streams)
Since I am currently attending Stanford, and I once searched the intraweb for a solution for downloading wmv streams, but couldn’t find anything specific, I’ll post my solution here.
Normally, SCPD requires you to login and then you watch the videos streamed using some wmv player. However, should you want to rewind or seek through a stream, this will prove to be impossible. Many commercial wmv recorders are not free, and simply play the video to download it. My solution is similar to this, but it is FREE (as in beer).
What you need:
- Mencoder (An encoder that comes along with Mplayer) If you use windows, you should get the command-line non-gui download from the website since it will come with mencoder. Otherwise it will not.
- Optional: Firefox + Greasemonkey for extracting the video URL if you’re lazy like me.
- Optional: Python for executing mencoder and for converting http:// links to mms:// links.
To download from SCPD (or other unprotected wmv streams), simply execute the following at a command prompt:
mencoder mms://stream.wmv -ovc copy -oac copy -o output.avi
- Replace mms://stream.wmv is simply the url with “http:” replace with “mms:”
- Replace output.avi with the output file name. Extensions should govern the format that it spits out.
It will throw a bunch of text to the screen, and you simply leave the window open (or minimized) and wait for it to finish. However, since it’s free, I commonly download several streams at the same time, so when they are done I will have several streams downloaded instead of just one.
Download: Greasemonkey script for SCPD (gets links automatically when you view an SCPD video) (Updated 9/29/09)
If you are lazy like me, and don’t want to change the http://url to mms://url I’ve provided an mencoder script that, given an http url, will fill out the commandline and execute it for you. (Note: Many mac and linux users will have python already installed on their machines.)
Usage:
./stripSCPD http://url
Download: Python SCPD script
#!/usr/bin/python import subprocess,sys def strip(url): newurl = "mms"+url[url.find(":"):] print newurl vidname = url[url.rfind("/")+1:url.rfind("?")] print "mencoder %s -ovc copy -oac copy -o %s.avi" % (newurl,vidname) subprocess.Popen(["mencoder", newurl, "-ovc","copy","-oac","copy","-o", ("%s.avi" % (vidname,))]) if __name__=="__main__": strip(sys.argv[1])
Update (11/09/08):
I’ve just tried everything again in windows, and it seems to work. Note, for some reason mplayer doesn’t have the necessary codecs by default in the downloadable zip file. However, VLC, media player classic and Windows media Player seem to be able to seek. However only media player classic can increase the audio speed (in case you want to watch a stream 1.5 times fast and be able to comprehend what someone is saying even if they seem to be on helium!).
Hi Jon,
Congratulations! You are very talented. I tried my best to download SCPD videos, but couldn’t manage that.
Still, I didn’t understand how to download videos. I tried on a Windows and on a Mac, but couldn’t get anything.
First, which file do I have to download for Windows? Can you give exact link? Also, a link for Mac would be great.
Second, when I write “mencoder …..” into the “run” window at Windows, it says that “Windows cannot find encoder”.
When I click on the encoder.exe, nothing happens.
Would you please help?
Thanks a lot.
I don’t own a mac, so I honestly couldn’t tell you.
For windows, the non-gui version of mplayer contains mencoder. http://www.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip
You have to have mencoder in order to download the videos with the scripts.
Thanks so much! I was not looking forward to getting this figured out myself.
The only thing I’d add is if you’re running debian, you can use the debian-multimedia repository to get mencoder and if you need it the wmv codec.
http://debian-multimedia.org/dists/testing/main/binary-i386/package/mencoder.php
http://debian-multimedia.org/dists/testing/main/binary-i386/package/w32codecs.php
Jon,
Thanks for the blog.
I’ve been successful in streaming lectures in WMP format.
Do you know of a solution to pull down lectures in SL format?
It’d be nice to be able to stream the free seminars which appear to get invoked in SL format only. Any ideas?
Seems that the SilverLight player on the SCPD previews page points to a wmv stream. So I’d just download the wmv stream, since that is what it seems to be streaming anyways.
Jon, have you tried downloading any lectures recently? I’ve been trying to download some recently, but have been having a lot of trouble. Neither MEncoder nor the other recorders out there seem to work anymore. It looks like SCPD has tightened things up…
I just tried downloading a video and it seems to work perfectly fine. Typically I just use the python script I’ve posted above. I also generally download using linux, but I’ve tested it on windows periodically.
Check to make sure your URL’s are correct. I haven’t tried silverlight videos, but the wmv’s should work fine. When I get some time later today, I may post a greasy script that grabs URL’s in case Stanford students feel like archiving links to download later.
hmmm…I don’t know what to say…
I did the exact same thing this quarter that I had been doing for the past year and all of a sudden everything stopped working. So strange!
Hi Jon,
Your script is very helpful. Instead of mencoder, you can use mimms btw.
PS: It seems that there’s no authentication in SCPD. Anybody knowing the links can download the videos. Has anybody tried to figure out the format of the links?
@Thai
I have tried using mimms, perhaps I passed it off prematurely (Only spent a few minutes trying to get it to work in the beginning). I use mencoder because almost everyone has it, since it comes with mencoder. It was just more convenient for me to use on Windows, Linux, Mac.
I’m aware of the “authentication” issue. This is probably because it is troublesome to implement authentication with wmv streams. They can only use authentication to obscure the links. There is no format for the SCPD videos since the beginning of Fall 08, because they started adding nasty hashes to all of their videos. I suggest you try using the greasemonkey script I posted recently to rip links.
Hi Jon,
I have downloaded MPlayer using the link you posted (http://www.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip), and also added Grease Monkey to the firefox addons list. Could you please advise a detailed step-by-step approach on downloading scpd videos for computer novices
. I clicked on mplayer.exe and mencoder.exe, but the command prompt opens and then closes instantly. How do we proceed after getting the MPlayer zip file and Grease Monkey? I am using Win-XP home and do not have Python.
Thanks a lot!
Hi Jon,
Thanks for your sharing this method. As you have pointed out, the SCPD video has now been protected by certain hash method. I wondered if the links are still static. If it’s so, is it possible that you could phase the links for some courses for me? I really want to watch some of these video, and I’m not intending to get the credits. Thank you very much!
Nope, I can’t repost links, since it’s against SCPD policy. For the record, the links to my knowledge are not static. Last I checked, they no longer work at the end of the quarter.
Thanks for posting the greasemonkey script and the instructions! What is the purpose of the ffmpeg step I see in the comments? (ffmpeg -i output.avi -ar 44100 -vcodec copy -acodec mp2 output2.avi) Are you trying to shrink the file size? If so, what are the tradeoffs as far as quality? Sorry if this is a dumb question but I’m not very familiar with audio/video formats and codecs.
If it’s in the comments in the greasemonkey script, it must’ve been something I was simply trying out. I think I was probably trying to convert the mencoder video to a better conditioned avi file. I don’t think it makes a difference, which is why I didn’t bother including it.
Thanks man, this helped tremendously!
This seems to work really well– the one difficulty I’m having is outputing these to a format I can put on my iPhone through iTunes. Any suggestions there?
Yes, convert to mp4. I don’t know if an iPhone can play it, but I know that quicktime supports it. Even my lesser phones seem to be able to handle mp4 so I’d assume an Iphone can handle it too. You can use ffmpeg to do it, or configure mencoder.