Capturing the Elusive Streaming Video

How to convert a YouTube or Google streaming video into a file that you can put in your pocket and carry around with you.

The Problem: Streaming Video is not enough.

Do you need to save a Youtube or Google video into a file? I’m not sure about the legality or practicality of doing this, so anything you read here could break your computer or get you arrested, that’s up to you.

I know I do this some times for a very good reason. My wife is a school teacher, and schools are run by reality-blind bureaucrats who come up with things like “zero tolerance” policies … so of course, most schools seem to have blocking of almost all useful Internet content, especially and including Google Videos and Youtube. So, if Amanda wants to show some useful video to her students, she can’t. The bureaucrats are happy, the students are uneducated. Whatever.

Linux to the Rescue

If you have a problem like this one, an obvious solution is to make a file of the video, throw it on a CD or wherever, and sneak it past the guards at the school.

If you have a Linux machine, this is easily done.

You should be running Firefox, you should have FFMpeg installed, and you should chew your food 23 times before swallowing. The first two are necessary for the present exercise, the third is just a good thing to do.

If you don’t have FFMpeg and you are running, say, Ubuntu (or any Debian system, I believe) go to a command prompt and type “apt-get install ffmpeg” (you may need to be SUDO to do this) and ever tying will take care of itself. Or you can use the GUI interface you normally use for installing stuff.

If you do not have Firefox on your computer then you must have removed it because it came with the computer. Install it.

Go get the video

Find the video you want to download. Perhaps this one. Play the movie. Don’t be doing other stuff while this is happening. Just keep your hands to yourself for once.

Now, type in to a terminal the foll wing command exactly as you see it here:

ffmpeg -i “$(find ~/.mozilla -regex ‘.Cache.‘ -a -not -regex \
‘._CACHE_.‘ -printf ‘%T+ %p\n’ | \
sort -n | awk ‘{ print $2 }’ | xargs file | \
grep -i “Video” | tail -1 | awk -F : ‘{ print $1 }’)” \
-vcodec msmpeg4v2 -b 200 -ab 64 -ar 22050 -s 320×240 \
/tmp/saved_video.avi

Just cut and past it. Sit back and wait for a while for the command to finish, and then go to this location:

/tmp/

to find this file:

saved_video.avi

Enjoy the show!

This Howto adapted from Paganini.net

Comments

  1. #1 Badger3k
    December 28, 2007

    There is a website that can convert some videos to flv files (that play on any flash-capable browser) – http://javimoya.com/blog/youtube_en.php , and it is simple to take that to ffmpeg, visualhub, or others to convert to different formats. Mac users also have access to TubeTV which can download and convert videos directly (not sure if this is available for other systems, only use Mac and XP currently, although I may install Linux on my Mac as well, just to try it out.

  2. #2 Doug Alder
    December 28, 2007

    nice – but if you’re using FF already why not just use one of the dozens of video/media downloader extensions available :)

    https://addons.mozilla.org/en-US/firefox/search?q=YouTube&status=4

  3. #3 Greg Laden
    December 28, 2007

    Doug:

    Can you personally vouch for any of these? I have had very mixed luck with downloaders, and I have had mixed luck with having too many extensions and addons to my browser.

    In other words, one could ask the question in reverse. Slamming a command line into the terminal that always works is a very good solution. Why use an extension that sits there like a dumb monkey on your browser’s shoulder all the time and then might not work when it comes time to work?

    Besides, look at that command line … it uses awk, it uses grep. You could probably rewrite it to use sed. Obviously, one can make this into a bash command that you could stick on your Gnome bar to turn any video into some file on your desktop where it will always be handy. Then you can show the little icon to your children and say: “I programmed that…”

    But yes, if one of these works, fine. I have not recently tested downloading addins, having more or less given up on them for the time being.

  4. #4 Doug Alder
    December 28, 2007

    I haven’t looked over the whole list but I installed video downloader 2.0 from videodownloader.net and have not had any problems with it. Then again I’m on an XP box so….. time to load up a linux box and start practicing my command line skills I guess :)

    Best of the New Year to you

  5. #5 Kapitano
    December 28, 2007

    I use Orbit Downloader, which is good for YouTube, GoogleVideo, Pandora, and also just as a download manager. Worth a try and free anyway.

  6. #6 Magnus
    December 29, 2007

    Do you need to save a Youtube or Google video into a file?

    Oh, only about every time I want to see one. Because I don’t have the necessary Flash plugin, and it’s not even supposed to be available for my platform. Don’t use Firefox either, but fortunately there’s a userscript available over at 1024k.de which makes it possible to download Youtube videos, and others.

    (For the Firefox users out there, the Greasemonkey extension can run these scripts if you’re interested, but then there are already specific tools available to download video available for you.)

    The catch is that as it is a userscript, it wants to run on the Youtube page for the video, so you need to fish the address for that out of the page source unless your friendly neighbourhood blogger has provided a direct link — which is something they don’t do. But at least it works in Opera, and I don’t have to switch browser and operating system.

    So that’s yet another alternative there.

  7. #7 Youtube downloader
    July 22, 2008

    Great guide!

  8. #8 gruntled atheist
    November 2, 2009

    …you should chew your food 23 times…

    Grandma said 28 times and I never argue with Grandma.

    Anyway, I have Ubuntu 9.1 with Firefox 3.5.4 and Youtube videos will not play. I have seen a solution for this but cannot remember where.

    So I will try downloading. Thanks.

  9. #9 Greg Laden
    November 2, 2009

    Gruntled: Go to your repositories and make sure “universe” is selected … reload repositories. Then search for “flash” in synaptic, and install it. There should be a version that has the name of your distribution and “nonfree” (which does not me “not free”). Restart firefox. That, or something like that, should do it.

  10. #10 Tom
    November 2, 2009

    Is everything we can download worth downloading? Hmmm… Well, not everything.

    But it is interesting how our ideas of individuality always wind up being in part the result of an inherent desire to confound the will of authority.

    I think, therefore I am. I am therefore there is no absolute system.

    (apologies to Descartes)

    A counter Thought from,
    Tom

  11. #11 Thomas
    July 11, 2011

    There is also a way to convert YouTube video to mp3 in case you need only a sound file to upload to iPhone or media player. For this purpose a YouTube to mp3 converter is used.