9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: mattmobile@proweb.co.uk
To: 9fans@9fans.net
Subject: [9fans] actionfs
Date: Sun, 22 Feb 2009 19:13:42 -0500	[thread overview]
Message-ID: <3ae1c6f4deba0584a1512966294daacb@steponnopets.net> (raw)

Hi,

this one was an experiment

/n/sources/contrib/maht/actionfs.c

invoked with a regex like  actionfs (file.mpg).([0-9]+).(ppm)

if you then

cat /n/actionfs/file.mpg.100.ppm

actionfs responds with the output from executing

/bin/action-read $fd file.mpg.100.ppm file.mpg 100 ppm

where $fd will be an fd to write to

i.e. trivially action-read would be something like

----
#!/bin/rc

fd = $1
shift

echo $* > /fd/$fd

-----

The coresponding action-write also works


----
#!/bin/rc

fd = $1
shift

cat /fd/$fd > /dev/null # or whatever

-----

I wrote it specifically to extract individual frames from video files using ffmpeg on Linux and
bring them into Plan9 for processing but generalized the arguments in case I thought of something
interesting later.

My first round of experiment went like this

cpu% cat /bin/action-read
#!/bin/rc

# expect fd fullname videoname frameno
fname = `{echo -n $3 | tr ! '/'}
{
	ssh storm single_frame $fname $4
} > /fd/$1


cpu% cat /n/storm/home/maht/bin/single_frame
#!/usr/local/plan9/bin/rc

# expect filename frameno

timer = `{echo $2  | awk ' { printf "%d.%02d\n",  $1/ 25, 4 * ($1 % 25) }'}
{
	ffmpeg -i $1 -t 00.001 -ss $timer /tmp/frame_$pid ^_%d.ppm
	cat /tmp/frame_$pid ^_1.ppm
	rm -f frame_$pid ^_1.ppm
	rm -f frame_$pid ^_2.ppm  # stupid ffmpeg outputs 2 frames (sometimes)
}  >[2] /dev/null


I was then using imgfs to calculate the average rgb value to look for black frames but (unsurprisingly) it was taking too long (4 secs per frame) esp. as the Plan9 I was using is in Qemu, cue installing Plan 9 on my terminal.

The ffmpeg part on the Linux side (2Ghz Opteron) was taking 1 second on its own so I have to come up with some sort of look ahead cache which is contrary to the idea, I may as well just convert the whole file to ppms at the start! I've not looked if it is I/O or CPU - perhaps a bit of both.

I've not got round to doing it on my fresh terminal yet. I've got a new 3.2Ghz Dual Xeon server to migrate to and a Quad Core terminal to play with so we'll see how that works out.

I was hoping to get Xcpu in there but I couldn't see how to get the Plan9 part working though I have the Linux bits up.

I have a couple of decent OSX boxes available too (one PPC one Intel) but I gave up getting it to compile :)

too many projects .....

matt



             reply	other threads:[~2009-02-23  0:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23  0:13 mattmobile [this message]
2009-02-23 13:31 ` Bruce Ellis
2009-02-23 13:41   ` roger peppe
2009-02-23 13:56     ` Bruce Ellis
2009-03-05 13:16 ` [9fans] (no subject) cej

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ae1c6f4deba0584a1512966294daacb@steponnopets.net \
    --to=mattmobile@proweb.co.uk \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).