9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] actionfs
@ 2009-02-23  0:13 mattmobile
  2009-02-23 13:31 ` Bruce Ellis
  2009-03-05 13:16 ` [9fans] (no subject) cej
  0 siblings, 2 replies; 5+ messages in thread
From: mattmobile @ 2009-02-23  0:13 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-05 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-23  0:13 [9fans] actionfs mattmobile
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

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).