From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3ae1c6f4deba0584a1512966294daacb@steponnopets.net> Date: Sun, 22 Feb 2009 19:13:42 -0500 From: mattmobile@proweb.co.uk To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] actionfs Topicbox-Message-UUID: a6024b98-ead4-11e9-9d60-3106f5b1d025 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