Tech Tip: Save an Online Video with your Browser (no extensions needed)
Sometimes when you're watching online videos on youtube or other sites, you want to save some of them for later offline playback. You've probably heard of Firefox extensions like DownloadHeloper that can do this, but sometimes you may only have a bare version of Firefox, or perhaps a different browser, one that doesn't have a plugin for doing this. Using the tip below, you can save videos no matter what browser you're using.
First, find the browser process id:
$ ps xfa | grep firefox # or grep any other browsers' name
Say, we get 12279. Note that you may get more than one result from the above command: you need the process id of the binary executable. The firefox command, for instance, is normally a script which starts the real binary.
Then, list its opened files, by:$ ls -lU /proc/12279/fd
This will show you the files opened by the process, there may be a lot of them. The file name is the file descriptor number, it is a symbolic link that points to the real file that is opened on that file descriptor. The output will look something like:
# NAME REAL FILE lrwx------ 1 grp usr ... 59 -> socket:[3372642] lrwx------ 1 grp usr ... 62 -> /home/gektop/.mozilla/firefox/u824gy5z.default/signons.sqlite lrwx------ 1 grp usr ... 70 -> /tmp/moz_media_cache (deleted) lrwx------ 1 grp usr ... 73 -> /home/gektop/.mozilla/firefox/u824gy5z.default/places.sqlite-journal lrwx------ 1 grp usr ... 74 -> /tmp/FlashZzxRDM lrwx------ 1 grp usr ... 75 -> /var/tmp/etilqs_5I5bzLh21aIoh4a (deleted)
Now look for names matching the pattern "/tmp/Flash??????". In the above example, we see /tmp/FlashZzxRDM. This is really a .flv file, you can open it with mplayer or any other video player and see that it is a video. If you see more than one file you may need to try playing them to see which one you're looking for.
The last step is to simply copy the file to your home directory, renaming it in the process (e.g. "jackson.flv"). Wait till after the browser has played the entire video, otherwise you may get an incomplete file.
Cheng Renquan, Shenzhen, China
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- I once had a better way I
2 hours 50 min ago - Not only you I too assumed
3 hours 7 min ago - another very interesting
5 hours 43 sec ago - Reply to comment | Linux Journal
6 hours 54 min ago - Reply to comment | Linux Journal
13 hours 48 min ago - Reply to comment | Linux Journal
14 hours 4 min ago - Favorite (and easily brute-forced) pw's
15 hours 55 min ago - Have you tried Boxen? It's a
21 hours 47 min ago - seo services in india
1 day 2 hours ago - For KDE install kio-mtp
1 day 2 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
My take on this
YouTube with no sound
The Tech tip works for most of the short videos that I have tried, but anything from youtube has the sound turned to white noise. Is there a way around this?
even easier
apt-get install -t lenny-backports clive
Then:
clive http://www.youtube.com/watch?v=whatevergobbledegook
More info on Flash players + videos
1) Some Flash players use the browser's cache so all one has to do is dig around under ".mozilla" (FireFox / SeaMonkey / other Mozzies), ".opera", ".netscape" (Navigator 9), etc. Use your file manager (Konq. / Nautilus / etc.) in reverse chronological order so that the most recently changed files are near the top.
I didn't know about fishing around in "/tmp". Thanks for the tip - I'll be trying it in the next day or so.
2) My usual way of playing ".flv" files is to use the Kaffeine front-end to xine. Due to the age of my distro (SUSE 10 Book) I also have MPlayer (".mov" + DVD's) and Ogle (DVD's) installed. KLUDGE CITY !
3) Google is also very useful because it can lead you to sites like "get2pc.com". That site is a somewhat flaky leech aimed at YouTube + clones. If you go there keep your eyes open for strange, new tabs opening in your browser. That's why I'm not providing a link - I don't want careless surfers getting trapped in web crud.
Paths (sample## is a placeholder - look for a weird folder name):
FF - ~/.mozilla/firefox/sample12.default/Cache
Moz. - ~/.mozilla/default/sample34.slt/Cache
Nav. - ~/.netscape/navigator/sample56.default/Cache
Opera - ~/.opera/cache4
Cache Info. - about:cache (Moz.-type) or opera:cache
one liner
RIP=$(ls -lU /proc/`pidof firefox`/fd | grep Flash | cut -d'>' -f2 | cut -d' ' -f2); echo $RIP; cp $RIP rip.flv; unset RIP;
you have to have only one flash movie playing
Might need pid of npviewer
On my opensuse system I found that the file is opened by npviewer.bin instead of firefox, so when you find the pid, check for npviewer.bin as well.
cool.. but what about
cool.. but what about streaming flash video?
Scripts
I posted some quick scripts for both Linux and OS X based on this article. You can check them out at www.standardload.org if anyone is interested. If you fix them or improve them, please post back!
Thanks! This is a great tip.
My script
I made a script that saves videos from the /tmp directory. I then added it to my top panel, and when clicked a zenity GUI box pops up and asks what I want to name my vid. Here is the script below. Go easy on me, it was the first script I ever wrote ; )
#!/bin/bash count=$(ls /tmp/Flash* | wc -l) function cancel { if [ "$?" = 1 ]; then exit 1 fi } if [ "$count" = 0 ]; then /usr/bin/zenity --error --title="ERROR!" --text="There is no video in your /tmp directory! exit 1 elif [ "$count" != 1 ]; then /usr/bin/zenity --error --title="ERROR!" --text="There are two or more instances of a .flv video in your /tmp directory, Nautilus will now open. Please select the video you want to save." nautilus /tmp/ else name=$(/usr/bin/zenity --entry --title="Name your Video" --height=100 --width=300 --text="Please name your video ") cancel cp /tmp/Fla* ~/Videos/"$name" filsof
When I wanted to temporarily save a copy of a video I found on-line, I used lsof to find the open files:
$ lsof | egrep "^firefox"
firefox 1160 username cwd DIR 8,1 12288 5128194 /home/username
firefox 1160 username rtd DIR 8,1 4096 2 /
firefox 1160 username txt REG 8,1 30232 3784876 /usr/lib/firefox-3.0.14/firefox
firefox 1160 username mem REG 8,1 88704 3745430 /usr/lib/libbeagle.so.1.0.2
firefox 1160 username mem REG 8,1 96324 3842741 /usr/share/mime/mime.cache
firefox 1160 username mem REG 8,1 68801 3907635 /usr/share/fonts/type1/gsfonts/n019024l.pfb
firefox 1160 username mem REG 8,1 320764 3893378 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
<...snip...>
Firefox opens a lot of files, so you might want to massage the data a little:
$ for File in `lsof | egrep "^firefox" | awk '{ print$9 }' | grep "^/"` ; do IsVideo=`file ${File} | grep -i video` ; if [ "x${IsVideo}x" != "xx" ]; then echo "${File}" ; fi; done
/tmp/plugtmp/plugin-TT103%20-%20zsync.ogv
/tmp/plugtmp/plugin-TT103%20-%20zsync-1.ogv
$
Superb
With this article and the suggestions from readers, plus the command
pidof firefox
one should be able to produce a script quite easily that does it all with a click. Just make sure there is only one video running at a time (why would you need more?)
Use hard links !
I use this trick, but without searching the files opened by the process. I simply knew that the last file beginning with Flash* in the /tmp directory was the one I needed.
But this file is deleted immediatly after leaving the html-page where the player is included.
So, with large files, when the download begins (you can see the file growing with $ls -l /tmp/Flash*), I create a hard link in my home directory:
$ ln /tmp/FlashZzxRDM foo.flv
You know; a file is'nt really deleted until the last name subsists for it. You can now see both files growing in parallel.
When the process deletes the file in /tmp, you still have it in your home :)
hard link is better, but
hard link is better, but just sometimes /tmp is on different partition with /home you may want to copy it, and hard link cannot operate over another mount;
However, if you are sure /tmp and dest dir under the same mount point, both hard link or copy works~
Cheng Renquan, Shenzhen, China
Scrap my last comment - this
Scrap my last comment - this is way simpler:
(replace 27164 with the process id of your browser)
ls --color=none -lU /proc/27164/fd | awk '{print $NF}' | xargs file
If the browser saves the
If the browser saves the file with a name other than /tmp/Flash???, you can still identify video files with the Linux "file" command.
In the following command, replace 27164 with the process id of your browser, as described in the original article.
for file in `ls --color=none -lU /proc/27164/fd | awk '{print $NF}'`; do file $file; done
Any output file that has a description of the form "Macromedia Flash Video" or "Video" is probably one.
why so complicated ?
you can simply type" about:cache" in the url and select your video file. There is also a plug-in for that here
You must be a Ubuntu user. LOL
Just kidding man.
tmp directory
Or you just go to /tmp directory and flv file is there ;-)
Look forward to Ogg Theora becoming de-facto standard
This is an oldie, but goodie, and it is a good way to save Flash video files, true. But I don't care for Adobe's buggy player, nor for their legal stance on the file format.
Fortunately, Firefox 3.5 includes Ogg Theora streaming right out of the box, so hopefully video publishers will start adopting it and saying "please install Firefox to view this content." Let's continue to promote this option.
--TP
cool trick
such an unorthodox method of doing this! love it, nice and technical.