• ARTICLES
SEARCH

How-To Geek

Saving Flash Videos In Linux

This guest article was written by Nate from The Geeky Life blog, who is also one of our most prolific forum members. Thanks!

Have you ever watched a video on Youtube or some other site that lets you view flash videos and then wanted to save a copy of the video to your hard drive so that you can watch it later,out but you then cannot because there is no download link?  This can be done very easily because when you watch a video on any of those sites they save a temporary file on your computer of the video.  So from there you will need to just find the file and rename it.

So the first thing you are going to want to do is go to the site with the video that you want to download. Once you are there you will have to wait for the video to fully load so that you will have all of the video when you make a copy of it later.

dvtrdgp_1czx3qtg2_b

You Can Tell When The Video Is Fully Downloaded When The Light Red Bar Is At The End Of The Box

Now from here you will need to navigate to Filesystem/tmp.  Now you will just need to find a file that has “flash” in the name of it.  In my case it is FlashZv9s8f yours should be something similar.  From here you will just need to copy and paste the file to where ever you want it and then rename it to whatever you want with the file extension .flv so in the end mine was “FlashZv9s8f.flv”.

dvtrdgp_2gs9t8rhk_b 

The Original Version And The Copied Version

To play the flash movies on your computer you can use VLC Player. In most versions of Linux you can find VLC pre-installed or in your package manager.

dvtrdgp_3g7wg57hs_b

Flash Video Playing In VLC

Now you are done and you can download all of the flash videos that you want onto your hard drive.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 01/29/09

Comments (58)

  1. fhunter

    youtube-dl will do it all automagically ;-)
    http://www.arrakis.es/~rggi3/youtube-dl/

  2. Hatryst

    At long last! A linux article!
    Thanks!

  3. James

    Excellent post :) foregive me if this is stupid question but i dont no the answer, is the above possible in Windows? If so wear should i look? – Thanks

  4. James

    I’m aware that there are programs out there that do it for you but I kinda like the idea of having it already on your hard drive and just finding it yourself … dont really want to install another app ….

  5. ashtonisdrugfree

    This is easily done, cross-platform with Video Download Helper Firefox extension.

  6. jack7h3r1pp3r

    @fhunter the point of the article was so that you don’t have to use any external resources. Because that site that you posted along with a bunch of others can do the same thing but you then have to go to those sites to preform the same thing that you can do locally

  7. Baobab

    Thanks, always great when you take up linux stuff!

  8. teslarage

    Hi HTG,

    That’s exactly how you do it in Linux! :D

  9. 1fastbullet

    Thank you, Nate.
    I used Download Helper before it was “upgraded” to the current, so-called Video_Download_Helper – it worked like a charm. But like so many other things that get upgraded, it suddenly quit working and, while it would indicate that a file was successfully downloading, it would render an empty folder.
    It makes the information here especially valuable to me.

    Next, maybe you could cover why Flash Video simply quits working altogether in Ubuntu, eh? (Mysteries abound in the world of Linux).

  10. James

    Yes but how do i do it in windows?? anyone??

  11. Mats

    James, just surf to the firefox web and search for a Firefox addon for downloading Youtube movies.

    /Mats

  12. sanjrockz

    Nice post. I’m using DownloadHelper plugin with Firefox. Try it here https://addons.mozilla.org/en-US/firefox/addon/3006
    With this, you don’t have to wait till the video gets loaded fully to your browser and get it saved in to your temp directory, instead place the download, close the browser and watch it while downloading it to dwhelper directory. Enjoy :)

  13. skajoeska

    Great article. First thing I thought about using this for would be to maybe get around MegaVideo’s 72 minute time limit. Not sure if it will work.

    Also, I started a youtube video and renamed the file to an .flv extension before the video had finished loading on youtube. After the video fully loaded on youtube I had the whole video in the tmp folder.

    It also seems that if I start a video, immediately move it before it’s loaded all the way, then rename it to the .flv extension I still get the whole video. The file slowly gets bigger as more of the video is loaded on youtube. So it follows the file and seems to continuously download which is why I thought of the MegaVideo time limit thing. If you download the whole file locally while watching it, what will make the video stop at 72 minutes?

    I downloaded a video through both firefox download helper addon and using the tmp method in this article. Both worked but I could only play the tmp video in Ubuntu’s totem movie player.

    VLC gave this error: “No suitable decoder module:
    VLC does not support the audio or video format “undf”. Unfortunately there is no way for you to fix this.”

    The tmp video was also .8 Mb smaller and used H.264/AVC Video codec vs download helper which used Sorenson Video. Also the tmp video used AAC audio vs mp3.

    sorry for the long comment. Cool idea with a lot of possibilities. Man, I love Linux.

  14. Bella
  15. skajoeska

    Follow up comment.

    If you don’t let the video load all the way, rename it, and watch it as it downloads, it comes out as H.264/AVC Video codec with AAC audio codec and you can only watch it through Totem Movie Player(which sucks at fastforwarding and rewinding). If you do let it load all the way then rename it you get Sorenson Video codec with Mp3 audio and can use the more awesome and better VLC.

    I’m not really sure about the quality difference between the codecs, but both seem about the same.

  16. Rub3n

    Firefox + Flashgot + kget/gwget

  17. fafasfdcas

    With FlashGot extension for FF this procedure takes just 2 clicks…

  18. James Lavin

    Thanks! This works even with Javascript-based links to .flv files. Just what I needed.

  19. pops

    @ James

    You should be able to find it within your browsers cache.
    Or use a plugin as already mentioned.

  20. rrp

    This appears to be a copy an article by Mitch Frazier originally published on 21st January 2009 in the Linux Journal. http://www.linuxjournal.com/video/how-save-flash-video

  21. The Geek

    @rrp

    The link that you posted is to a video… this is clearly a written article and not a copy of anything.

    This article is simply detailing a very common technique that has been used and written about by many others for years.

  22. onan

    This technique works under any os not just linux, it’s just a matter of understanding that to display any remote content locally, it has to be retrieved. It usually lives in browser cache or temporary folders. (windows user may have to rely on unlocker to copy the file).

    But this method is certainly not a true way of downloading flash video, as you have to have flash plugin and go to the actual website and wait for the video to stream in its entirety.

    There are tools that allow to download these videos such as clive (http://clive.sourceforge.net/) or websites such as http://vixy.net

  23. Alan Jones

    Another thing I’ll often do is make a link as in

    ln /tmp/Flashblah ~/thevid.flv

    important thing is not to use a symlink (ln -s) though this means it need to be on the same block device, but now if you accidentally close it after it’s loaded, but before saving it’ll still be there. Links are very awesome – like having multiple copies of the same file without any additional space. No matter which one you delete the others remain. Though once you delete the last one the file is really gone.

    Cheers,

    Alan.

  24. corneliu

    Question: “Yes but how do i do it in windows?? anyone??”
    Answer: Install Linux.

  25. Sum Yung Gai

    ‘Question: “Yes but how do i do it in windows?? anyone??”‘
    ‘Answer: Install Linux.’

    +1! Couldn’t agree more. Linux has definitely made my maintenance workload plummet.

    @James: You would do well to give a desktop-oriented Linux distro a try. Ubuntu is a very good choice. So is Debian, ever since the slick GUI installer a couple of years ago. A Latin American family I know has been on Kubuntu for just over a year now. They do everything with it–videos, IM, iPod, MySpace/Facebook, etc. with no fuss, and in two languages. :-)

    Now, for downloading videos from YouTube, I use a GPL’d script called “youtube-dl” that some kind soul wrote (just Google for it). It’s written in Python and is very easy to use. Adobe Flash *NOT* required for using it, either! I download the videos with youtube-dl, and then I just use my favorite video player–usually MPlayer or VLC–to watch them.

    –SYG

  26. fresno

    Congratulations and thanks for this post. Just what I was looking for: A way to download flash videos without installing more stuff. :D

  27. Linux

    Great article. You show how saving Flash videos is less complicated than people make it seem to be.

  28. Blake

    I liked this so much I made a script for it. Pretty much the script will let you know if there is no video in your /tmp, or if there is more than one it opens the /tmp folder so you can pick the one you want. Otherwise it just opens a box with zenity to let you name it.

    #!/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 saved in your /tmp directory. Please wait until it is completely saved.”
    exit 1

    elif [ "$count" != 1 ]
    then /usr/bin/zenity –error –title=”ERROR!” –text=”There are two or more instances of a flash 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”

    fi

  29. Darkman

    This really doesn’t work for me. Yes, there are Flash* filss, but this are only the advertisement banners. The main video is just not there…

  30. Darkman

    Hello,

    I have to apologize. The matter is that you have to be quick, because when the video once plays to the end, it disappears. Thanks for the post, works cooool :-)

  31. Jonathan

    I can confirm that this works with MegaVideo (I just downloaded a 2h video).
    If you want to get around the limit and not have a bunch of flash videos on your disk, you can also just change your IP!

  32. shilpa

    it ws just awesome..thanks!!

  33. Potato

    This trick stopped working with the most recent build of Flash Player 10.1 64 bit. What it does is delete the /tmp/FlashXXXXX file immediately after opening the file handle.

    However, the plugin (and thus you) can exploit a trick of the Linux kernel to access this file despite it being “deleted”.

    Navigate to /proc/`pgrep firefox`/fd/

    now, ls -1 | grep \/tmp\/Flash

    Those will be any / all videos the plugin would’ve downloaded via HTTP. (rtmp files never made it here, fyi.)

    So, as long as the plugin is in memory and the file handle still open, the kernel will keep a hard link to that file. You can simply copy the file descriptor number to your videos folder, and all will be well.

    This works because the kernel will not mark the inode associated with a given file as actually free until the hardlink count reaches zero.

  34. Richard

    Thanks for the tip, Potato! I had to modify the command a bit to work on my system. Here’s what I came up with:

    for i in $(pgrep -f libflashplayer.so); do ls -l /proc/$i/fd/* | grep -i ‘/tmp/Flash’; done

    This looks specifically for libflashplayer.so on the command line and handles the case where there may be more than one process that matches. It also prints the full path to the file descriptor.

  35. Dr_Barnowl

    So to take this a little further ;

    for i in $(pgrep -f libflashplayer.so); do ls -l /proc/$i/fd/* | grep ‘/tmp/Flash’ | grep -o “/proc/$i/fd/\\S*” | xargs cp -t ~/Videos/ ; done

    That will copy all cached Flash videos to the ~/Videos folder, named for the number of their file descriptor.

    Thanks for the heads up about the deletion though – not something that could be done on Windows.

  36. Dr_Barnowl

    Oh, and beware the stupid commenting software replacing quotes with “pretty” versions ; replace them back with the plain versions.

    Why would a geek site have such an unfriendly character munging feature :-{

  37. Mad_maarten

    Hi, I was just on this and this is what I came up with to “wait” for the file to be downloaded completely:

    S1=`stat -c %s $1`
    sleep 2
    S2=`stat -c %s $1`
    echo $S1
    echo $S2
    while [ "$S1" -ne "$S2" ]; do
    echo -ne “\r\E[K”
    echo -ne $S1
    S1=`stat -c %s $1`
    sleep 3
    S2=`stat -c %s $1`
    done
    cp $1 ~/Videos/$2.flv

    Not a perfect solution, with my flaky connection. Is there a better way to do this?

  38. someone

    A little bash script that lists the videos:

    #!/usr/bin/env bash

    for flashpid in $(pgrep -f flashplayer.so); do
    cd “/proc/$flashpid/fd”
    for video in $(file * | grep ‘/tmp/Flash’ | sed ‘s/\(^[0-9]*\).*/\1/g’); do
    echo “/proc/$flashpid/fd/$video”
    done
    done

  39. flipjargendy

    Awesome this is better than any script or app I have used. Never knew it was so easy. All I have to do is a cp of a temp file and I’m done! Thanks for the info!

  40. anon

    list video files used by plugin-container/Flash with Firefox 4, flash plugin “Shockwave Flash 10.2 d151″:

    for p in `pidof plugin-container`; do file -L /proc/$p/fd/* |grep Video | cut -f1 -d:; done

  41. cj

    if you do a “ln -L /proc/$PID/fd/$FD $new_name” you actually undelete the file. the advantage here is that you get the changes and you dont have to wait for the copy or waste the space.

  42. eebrah

    Thanks guys [ particularly potato , Dr_Barnowl, cj ], was used to copying straight from /tmp and was stumped when I couldn’t any more. Cannot wait for HTML5′s tag to take over from flash video.

  43. zedi

    cj,
    I’m just an average user (not a geek); when I tried your command
    ln -L /proc/$7062/fd/$FD $video.flv
    I’ve got → ln: invalid option — ‘L’

  44. Chetan Crasta

    While you can get the flash videos from firefox’s cache, it is not as convenient and reliable as getting it from the /tmp directory.

    Therefore, if you want to restore this ‘feature’, you will need to downgrade Flash to version 10.1.102.64

    The download link for older versions of flash is http://kb2.adobe.com/cps/142/tn_14266.html

    Download the (large) file named “Flash Player 10.1.102.64 and 9.0.289.0″.
    After downloading, extract the file named flashplayer10_1r102_64_linux.tar.gz

    From this file extract libflashplayer.so and overwrite the file at /usr/lib/flashplugin-installer (you will need root privileges, try gksudo nautilus)

    Restart Firefox and your flash videos will land up in the /tmp directory as before! This won’t work for Google Chrome, it will continue to use the latest version of Flash.

    Note: For the above steps to work, a version of Adobe Flash should have been previously installed.

  45. Yvan Dubois

    It is not working anymore

  46. Yvan Dubois

    *even if downgrading to the version Chetan Crasta mentionned

  47. aNeutrino

    this works for me (debian, ubuntu):
    0. go to the web page with flash movie.
    1. wait for full download of flash movie in the tab (do not close the tab)
    2. run command:
    D=/tmp/flash; mkdir -p $D; cp -v $(lsof | grep Flash | awk ‘{print “/proc/”$2″/fd/”$4}’ | grep -o -E ‘.*[0-9]‘) $D
    3. you can find files in /tmp/flash

  48. Dangerous

    I’ve tried all of the scripts listed here with no success. I’m a newbie running Linux Mint 10, so the Ubuntu compatible scripts _should_ work…

    the last one I tried was aNeutrino’s and I got this:
    ===
    D=/tmp/flash; mkdir -p $D; cp -v $(lsof | grep Flash | awk ‘{print “/proc/”$2″/fd/”$4}’ | grep -o -E ‘.*[0-9]‘) $D
    awk: ‘{print
    awk: ^ invalid char ‘�’ in expression
    cp: missing destination file operand after `/tmp/flash’
    Try `cp –help’ for more information.

  49. Arielle

    Dangerous,

    Dr_Barnowl’s November 2010 still works for me. But I had to change a couple of things:
    1. corrected the quotation marks (it won’t work if you just copy-paste it because of rich formatting)
    2. changed ~/Videos/ to ~/Desktop because I have no Videos folder

    Cheers!

  50. aNeutrino

    Arielle is right … the issue is with quotations marks:
    ” should be double quotation mark and
    ‘ should be single quotation mark
    you need to replace them (every of them) manually after you copy the command. from this page.

  51. Ani

    Thanks Dr and aNeutrino the change:
    for i in $(pgrep -f libflashplayer.so); do ls -l /proc/$i/fd/* | grep ‘/tmp/Flash’ | grep -o “/proc/$i/fd/\\S*” | xargs cp -t $HOME/Desktop ; done
    worked, but I am wondering how to add a rename to above with flv extension?

  52. naveen

    I had been using this method for a long while. Copy from file system and paste in my folder . But recently this facility to download videos from youtube or some other means is being a hard task.
    No longer this easy method favoured me . Any other way to suggest me to save a video ?

  53. Pazis

    Thanks. Good Article.

  54. lefth

    I just made my own version, which is more verbose but easier to debug when something goes wrong:

    lsof | awk ‘/\/tmp\/Flash[a-zA-Z0-9]+ \(deleted\)/ {print $2, $(NF-1)}’ | uniq | while read line; do
    pid=`echo $line | cut -f1 -d’ ‘`
    fname=`echo $line | cut -f2 -d’ ‘`
    cd /proc/$pid/fd >/dev/null

    # we are looking for
    # lrwx—— 1 xx users 64 Aug 11 00:06 11 -> /tmp/FlashXX8ImzgU (deleted)

    descriptor=`ls -l | grep “$fname” | awk ‘{print $(NF-3)}’`
    name=`basename $fname`

    cd – >/dev/null
    cp -v “/proc/$pid/fd/$descriptor” ./${name}.flv
    done

  55. North

    I used Dr_Barnowl’s solution very successfully a month or so ago, but when I try to use it now I am getting the following error:

    for i in $(pgrep -f libflashplayer.so); do ls -l /proc/$i/fd/* | grep ‘/tmp/Flash’ | grep -o “/proc/$i/fd/\\S*” | xargs cp -t ~/Videos/ ; done
    cp: missing file operand
    Try `cp –help’ for more information.

    I’ve no idea what has changed, but it just will not work for me now. Am I missing something? Thanks in advance!

  56. Strafer

    This works good for me:
    #!/bin/sh
    # find deleted Flash files and create sym-links to them
    # so you can watch and/or make a copy of the flv file.
    cd /tmp
    for pid in $(pgrep -f libflashplayer.so)
    do
    for file in $(file -L /proc/$pid/fd/* |grep Video | cut -d: -f1)
    do
    fd=${file##*/}
    ln -vs $file Flash${pid}${fd}.flv
    done
    done

  57. bisoft

    Hi friends,
    May be the best way to do it in Linux (ubuntu, I am using LinuxMint on Ubuntu) is on a wonderful program at :

    http://code.google.com/p/damnvid/wiki/LinuxDownload

    You simpy should enter in the Terminal this code :

    sudo add-apt-repository ppa:damnvid/ppa
    sudo apt-get update
    sudo apt-get install damnvid

    the program easily copies the URLs from almost any website and converts it into (.avi) format with wonderful quality in /yourname/videos/damnvid/vimeo/…
    Perfectly works on 11.04 and 11.10 Ubuntu / and Ubuntu based Linux systems.
    Good day …

  58. Zunda

    You can also use the lsof and cp to do the deed? Any geek out there help I

Enter Your Email Here to Get Access for Free:

Go check your email!