You are not logged in.

#1 2011-03-09 10:16:19

sie
Member
Registered: 2010-06-30
Posts: 27

Mplayer-ing flash videos

Before I updated flash I could easily play flash videos, which have been downloaded by flash itself by playing /tmp/Flash*, but now they're gone. Kind of. :]

Fortunately we've got nice utilities to track flash's evil works.

s|~ % lsof | grep Flash
plugin-co 25067          s   18u      REG      254,1 12353915  212607 /tmp/FlashXXIxfnki (deleted)
plugin-co 25067 25069    s   18u      REG      254,1 12353915  212607 /tmp/FlashXXIxfnki (deleted)
# and couple more of similar records

They're writing it in a deleted file! They bastards!
Scj in IRC pointed me out that there's /proc, which I can use to peak at plugin-container's fds and so I did... So we do this:

alias f="mplayer /proc/\$(pidof plugin-container)/fd/\$(ls -l /proc/\$(pidof plugin-container)/fd | grep Flash | pcregrep -o '[0-9]+(?= ->)')"

Put this in .{zshrc,bashrc,whatever} and hurray! — feel like you've outsmarted adobe!

NOTE: may not work, if you've got more than one video there. :]

Last edited by sie (2011-03-09 10:20:29)


Offline

#2 2011-03-09 10:39:50

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: Mplayer-ing flash videos

mplayer $(d=/proc/$(pidof plugin-container)/fd; ls --color=no  -l $d | gawk '/\/tmp\/Flash/ {print "'$d'/" $9}' ) 

Will work if you have more than one flash movie loaded.

Offline

#3 2011-03-09 22:44:12

VCoolio
Member
From: Netherlands
Registered: 2010-01-05
Posts: 118

Re: Mplayer-ing flash videos

Hah, I wondered what happened to my /tmp/Flash files. Fixed. Beat flash. Thanks a lot, wouldn't have figured that out. flash () { cp $(what you said) flash.flv } . And done. Should maybe pipe it to a converter to really outsmart adobe, but meh. For conkeror, plugin-container=xulrunner-bin, for those looking.

Offline

#4 2011-03-23 02:09:57

hagabaka
Member
Registered: 2010-12-15
Posts: 26

Re: Mplayer-ing flash videos

Amazing! It doesn't work when there are multiple plugin-container processes though. Isn't that expected to happen when there are multiple Flash plugins open?

Offline

#5 2011-03-23 04:11:12

quigybo
Member
Registered: 2009-01-15
Posts: 220

Re: Mplayer-ing flash videos

It seems that for webkit browsers it runs under the browser name itself:

$ lsof | grep Flash
plugin-co 15812       chris   17u      REG        8,3  25246995     408785 /tmp/FlashXX2p80Ou (deleted)
...
luakit    30544       chris   32u      REG        8,3  26746417     408783 /tmp/FlashXXWnVzYf (deleted)
...
midori    30777       chris   67u      REG        8,3  21056134     408784 /tmp/FlashXXgSdtCK (deleted)
...

Thats firefox, luakit and midori all playing one instance of flash each.

Also, personally I prefer to have a function that just returns a list of files:

flashfiles() {
    local pids=( $(pidof plugin-container xulrunner-bin luakit midori whateverwebkitbrowseryouuse ) )
    for pid in ${pids[@]}; do
        stat --format='%N' /proc/${pid}/fd/* | sed -n '/Flash/ s@`\([[:alnum:]/]*\).*@\1@p'
    done
}

... then you can do whatever you want with it:

$ mplayer $(flashfiles)
...
$ cp $(flashfiles) /some/dir/

Offline

#6 2011-03-23 08:24:51

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Mplayer-ing flash videos

This doesn't work here... I first tried it with luakit, but the problem of that was mentioned. So I opened it in Firefox. My link is http://videos.arte.tv/de/videos/die_wol … 72992.html. I opened it in Firefox (version 4) and the video is running now. But there's no output of the command lsof | grep Flash. I don't know what's wrong here... Does this only work for Firefox (version 3)?

Last edited by Army (2011-03-23 08:27:45)

Offline

#7 2011-03-23 17:03:37

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: Mplayer-ing flash videos

i personally don't use multiple browsers to watch flash videos so checking multiple commands is pointless for me.
hence, with ideas from quigybo (your version didn't quite work for me for some reason) and some gawk from scj, this is my simple way of playing all flash files for a single browser:

ZSH:
for f (${$(file /proc/$(pidof luakit)/fd/*|gawk '/\/tmp\/Flash/ {print $1}')//:}){mplayer $f}

BASH:
for f in $(file /proc/$(pidof luakit)/fd/*|gawk '/\/tmp\/Flash/ {print $1}'); do mplayer ${f%:}; done

similar bash version included for completeness though i personally don't use it.
if you use `echo' instead of `mplayer' you just get a list, and it should be easy enough to create a simple function for renaming/moving them or whatever.
this works for me so could possibly work and/or be another alternative for someone else... just throwing mine into the pile. tongue

Offline

#8 2011-03-24 00:22:26

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Mplayer-ing flash videos

Army wrote:

This doesn't work here... I first tried it with luakit, but the problem of that was mentioned. So I opened it in Firefox. My link is http://videos.arte.tv/de/videos/die_wol … 72992.html. I opened it in Firefox (version 4) and the video is running now. But there's no output of the command lsof | grep Flash. I don't know what's wrong here... Does this only work for Firefox (version 3)?

Ok, seems like this method simply doesn't always work. Maybe there's a solution for sites like this one (arte.tv)?

Offline

#9 2011-03-24 09:34:52

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: Mplayer-ing flash videos

Isn't there a better approach?
It should be surely possible to remove the deleted-marking again. But how?
There could be a inotify based daemon that goes into the /proc/flash-pid/fd and unmarks any deleted files...


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#10 2011-03-26 07:16:55

hagabaka
Member
Registered: 2010-12-15
Posts: 26

Re: Mplayer-ing flash videos

This works with multiple plugin-container processes for me:

#!/bin/sh
# Play flash videos in mplayer
# https://bbs.archlinux.org/viewtopic.php?pid=901228#p901228

# The original: works only when there is only one plugin-container process
# mplayer $(d=/proc/$(pidof plugin-container)/fd; ls --color=no  -l $d | gawk '/\/tmp\/Flash/ {print "'$d'/" $9}' )

videos=
for pid in $(pidof plugin-container)
do
  d=/proc/$pid/fd
  videos="$videos $(ls --color=no  -l $d | gawk '/\/tmp\/Flash/ {print "'$d'/" $9}')"
done

if [ "$videos" ]
then
  mplayer $videos
else
  echo 'No Flash is loaded'
  exit 1
fi

Offline

#11 2011-03-26 07:24:21

Wintervenom
Member
From: /home/wintervenom
Registered: 2008-08-20
Posts: 1,011
Website

Re: Mplayer-ing flash videos


My [GitHub] and my [artwork].
Data is guaranteed to stay crunchy in milk.
Keep your _✍ hand strong.

Offline

#12 2011-03-26 16:53:40

hagabaka
Member
Registered: 2010-12-15
Posts: 26

Re: Mplayer-ing flash videos

I think this works by scraping the video source URL from the web page, so it requires code to be written for each of the many types of Flash video players to work. Something similar is the Video5 Chrome extension, for which I contributed some code. On the other hand the method in topic should work for most Flash players that download videos to a file while playing them.

Offline

#13 2011-03-27 11:49:06

v1d
Member
Registered: 2010-10-13
Posts: 6

Re: Mplayer-ing flash videos

Army wrote:

Maybe there's a solution for sites like this one (arte.tv)?

arte.tv uses RTMP, so there's no video saved. get-flash-videos supports arte.tv though. (And some other RTMP-sites)

Offline

#14 2011-03-27 13:56:11

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Mplayer-ing flash videos

v1d wrote:
Army wrote:

Maybe there's a solution for sites like this one (arte.tv)?

arte.tv uses RTMP, so there's no video saved. get-flash-videos supports arte.tv though. (And some other RTMP-sites)

Now there even is a package in the AUR called artevideos, really a great script, which provides playback with mplayer (and other players) and recording (saving the stream).

Offline

#15 2011-03-27 14:20:17

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,844
Website

Re: Mplayer-ing flash videos

every command mentioned above does exactly nothing here... the lsof command shows me some npviewer. processes, but replacing plugin-container with npviewer. does nothing

*edit*

k... with flash-prerelease i can get it to work

Last edited by Rasi (2011-03-27 15:15:34)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

Board footer

Powered by FluxBB