How to Save Online Videos in Linux With Almost Zero Effort
written by: anwar_h•edited by: Lamar Stonecypher•updated: 5/19/2011
Anyone can save streaming videos from many of the Internet's most popular video-sharing sites with minimal effort and no technical knowledge. This article shows how this can be done in Linux.
slide 1 of 2
The problem with saving streaming flash video and how it can be overcome
Anyone who has dabbled in saving online streaming Flash videos knows that there are a many ways of going about it. The most popular method seems to be visiting a video download website that requires the user to paste a Youtube or some other video sharing site's url, after which it attempts to download the video in its native flv(Flash Video) format. Some sites even offer on-the-fly conversions to a variety of other video formats that are easier on the average media player than flv. When it works it can be an easy and convenient way to save online video, but people who use these sites on a regular basis know that it can also be an extremely frustrating experience at times. Connection time-outs are common, file conversions don't always work they way they should and many video sharing sites periodically update their APIs and streaming mechanism to specifically combat such video download sites.
There are also standalone programs that download Internet Flash video. In Windows many download managers offer Internet streaming video downloads as an added feature. The best of these download managers is Orbit Downloader, which is one of a few programs that will download from nearly every video-sharing site, and surprisingly, it is free to use. For Linux, there are a plethora of scripts and programs to download and, in some cases, convert streaming Flash video. The most notable of these programs are Youtube-dl, PyTube, both of which feature GUIs, and the excellent Clive, which is a command-line program. Sadly all of these utilities are dedicated only to Youtube, you're out of luck if you want to save from any other video-sharing site.
Now that I have highlighted the pitfalls and frustrations of saving online streaming Flash video using conventional tools, I shall demonstrate a fool proof method to save streaming videos straight to your hard disk without having to use any third-party programs or visiting any video download sites. I have successfully used this method in Ubuntu Linux for over 2 years, but all the directions shown in this article should apply to any modern Linux release.
Since we're using Linux our primary browser and Flash video player, provided the right plugins are installed, is Firefox. Every time we play a video on Youtube or from some other video sharing site, the video caches in your computer. You can see this in Youtube when the little red bar expands, that's the video download progress indicator. The video is downloaded in two places on your hard-drive: the cache folder in the current user's Firefox profile directory and in Linux's tmp directory. The tmp directory typically holds all temporary files needed by the system at any given time and is found at "/tmp". The tmp directory is invaluable in our attempts to save streaming flv video.
The cache folder in the Firefox profile directory is normally found in the current user's home directory, for example "/home/user1/.mozilla/firefox/dfg6njzu.default/Cache". This is a hidden directory and you won't normally see it in your file manager, you will have to manually type out the path or change the settings in your file manager to show hidden files. In addition to being difficult to locate, the Firefox cache directory is normally very cluttered with hundreds of files - remnants from the most recent browsing session. It can be overwhelming to sift through all those files to find one downloading Flash flv video file. This is why I highly recommend you ignore the Firefox cache directory and focus solely on the /tmp folder to find the downloading flv file.
slide 2 of 2
Save flash video effortlessly with your "tmp" folder
The tmp folder is not cluttered and you can quickly locate the cache file of any streaming flv Flash video, which will be found in the root of the /tmp folder. Look for a file that starts with the letters "Flash" followed by a bunch of random characters. This file will also be constantly growing in size as the download progresses, check its file properties to confirm this. You don't have to sit and wait until the entire flv file is downloaded before you can rename or move it, you can do all these operations on this file as it downloads. None of this will interrupt or adversely affect the flv Flash video's download - this will blissfully continue regardless of your manipulations. Once the file-size stops growing that means the entire flv file has been successfully downloaded into your computer's cache. Congratulations! You have successfully downloaded your first streaming Flash video file without doing anything more than hitting the "play" button on the video and cutting-and-pasting the flv file from your tmp directory to another.
As I mentioned before, it is a good idea to name the files as they are downloading. Give it a descriptive name like "Chocolate Rain.flv", which lets you instantly know what's on the video as opposed to the default filename of Flash5x869p. Although filenames in Linux do not require extensions, consider giving your downloading Flash video files the extension ".flv", this is the native format of all Internet streaming Flash video. You can convert flv files to your format of choice or you can play them directly with media players such as VLC, Mplayer or any Gstreamer based media player. I find that sometimes a flv video from a particular site will have sync problems with Mplayer but will play perfectly in VLC and vice-versa, so mix and match your media players to find the best solution.
The beauty of this solution is that it works with most video-sharing sites on the Internet, we aren't limited to a handful of two or three popular sites as we are with third-party programs or video-download sites. I have personally used this method for the following sites and can confirm that it works like a charm: Youtube, Dailymotion, Veoh, Youku, Tudou, 56.com, Megavideo, Blip.tv, Metacafe, Yahoo Video, and Google Video. These are just a few sites off the top of my head, I have tried this method with many fairly obscure Russian, Spanish and Chinese video sharing sites and it seems to work in all of them as well. It also works with most adult flash video sites. Some sites do have a few quirks in their video caching mechanism, but these are easily overcome with a little experience. For a vast majority of these sites all you have to do is hit "play" and wait for the complete flv video to download to your /tmp folder.
Now, sadly, this method of saving videos does not work with all Flash video sharing sites. Flash videos from Break.com appear only in Firefox's cache folder and not in the /tmp folder. This method does not work at all with streaming Flash video from high profile media sites such has ComedyCentral.com and NYTimes.com; playing videos from these sites show nothing in both the Firefox cache and the Linux tmp directory. Because of my geographic location I am unable to try Hulu.com, so if any reader would be willing to see if Hulu streams are saved in Firefox's cache or the tmp folder and let me know it would be greatly appreciated. For the time being, I am assuming that the large conglomerates behind Hulu will have made it impossible to save their content so easily.