How to play flash videos with the media player of your choice

Notice: This method will probably not work on all YouTube videos.

Remember the good old days when you could pause a flash video, let it buffer and play the video with the media player of your choice by opening the corresponding file from the /tmp directory?

Well that’s still possible. However the video-files are deleted from the /tmp directory. So you need to find the PID of the flash plugin-container to open the video from /proc/PID/fd/.

get the PID:

ps x | awk '/\ /{print $1}'

Use the PID to move to the corresponding folder in /proc:

cd /proc/$(ps x | awk '/\ /{print $1}')/fd

improvement to list only the video-files:

cd /proc/$(ps x | awk '/\ /{print $1}')/fd && ls -la 
                | grep /tmp/Flash
  • Or simply use this shell script to play all videos with VLC:
    cd /proc/$(ps x | awk '/\ /{print $1}')/fd
    ls -la | grep /tmp/Flash | vlc $(awk '/\ /{print $8}')

About M0nk3ym0nk3y

M0nk3ym0nk3y is one of the three LinuxM0nk3ys from Linux M0nk3ys @ WordPress Linux M0nk3ys @ YouTube Linux M0nk3ys @ Twitter

Posted on April 22, 2012, in Audio / Video, Bash-Scripts and tagged , , , , , , , , , , , , . Bookmark the permalink. 10 Comments.

  1. hi, I have no idea about any of the things you are talking about, but after many hours searching the web, I found your thunderbird pdf thingy!! you seem to know your stuff! I cant get a pdf to attach to an email without it hanging (not responding) sometimes til it s
    huts down, other times for a minute or two. I tried to send via outlook, but had the same problem! im net very tech savvy, but can follow instructions, any ideas?? thank, have a good one, jo xx cheers

    • Drunk3nm0nk3y

      Hello jo, first let me tell you that you commented on the wrong post. The right post would have been:

      However I will try to help you to solve your problem, but I will need more information from you:
      – What Operatingsystem do you use (Windows / OS X / Linux)?
      – Did you try to fix the problem by following the steps described in the post?

      One more thing, I don’t know much about Outlook, I can only help you with thunderbird. The most important thing right know is to find the file “mimeTypes.rdf” on your system. It should be in an hidden directory in your home-directory.

  2. Excellent information. Thanks for the post. I’ve been trying to find the best command to see if flash is running. Yours seems the best (ps x | awk ‘/\ /{print $1}’) but it doesn’t care if the process is running, sleeping, or zombied. I’m trying to write a script that will check if flash is active and toggle the power manager settings based on that. Any suggestions?

    • Drunk3nm0nk3y

      so you want to know the state of the process (sleeping, zombie, etc.), right? I’m no expert on this stuff, but will try to help you.

      1) This command will print all informations about the process:
      ps x | awk '/\ /{print}'

      24246 ? Sl 0:59 /usr/lib/firefox/plugin-container /usr/li... 21739 plugin

      Notice the “Sl” in the output? If you take a look into the manpages of “ps” you will find the following table of process State-codes:

      Here are the different values that the s, stat and state output specifiers
      (header "STAT" or "S") will display to describe the state of a process:

      D uninterruptible sleep (usually IO)
      R running or runnable (on run queue)
      S interruptible sleep (waiting for an event to complete)
      T stopped, either by a job control signal or because it is being traced
      W paging (not valid since the 2.6.xx kernel)
      X dead (should never be seen)
      Z defunct ("zombie") process, terminated but not reaped by its parent

      For BSD formats and when the stat keyword is used, additional characters may be displayed:

      < high-priority (not nice to other users)
      N low-priority (nice to other users)
      L has pages locked into memory (for real-time and custom IO)
      s is a session leader
      l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
      + is in the foreground process group

      So the process is in interruptable sleep state (waiting for an event to complete) and multi-threaded.

      2) I modified the command and it now only prints the PID and the State:
      ps x | awk '/\ /{print $1 " " $3}'

      24246 Sl

      I hope that I could help you to solve your problem. If you need further help feel free to comment again.

      • Can you give me a suggestion or point me in the right direction to create an expression that reacts to the state or a process? When I do a simple if … then as long as it returns a PID that is a “true” and triggers the “then” response, but I only want to trigger the response for a specific state. Thanks for your help.

      • It seems that a for loop might be what I need, but I’m having trouble getting the script to act only for the given state. I’m trying:
        for Rl in “ps x | awk ‘/\ /{print $3}”

        This sort of works, but it executes command1 even if the state is Sl. Ideas?

      • Figured it out. I had to abandon using states because that was the wrong tack. Instead I took advantage of the relative resource heaviness of flash and had it monitor the CPU usage of the plugin. When it reaches a threshold it triggers the command. Thanks for setting me in the right direction.

      • Drunk3nm0nk3y

        You’re welcome, I am glad you figured it out. Nice solution and thanks for sharing it here!

  3. flash_check=$(ps x | awk ‘/\ /{print $1}’ | grep -v ps)
    FLASH_USAGE=$(ps aux | grep $flash_check | grep -v grep | grep -v ps | awk ‘{print $3*100}’)

    In case anyone wants to use the solution I came up with.

  1. Pingback: How can I access Flash files from streaming websites?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: