From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <3ae1c6f4deba0584a1512966294daacb@steponnopets.net> References: <3ae1c6f4deba0584a1512966294daacb@steponnopets.net> Date: Tue, 24 Feb 2009 00:31:37 +1100 Message-ID: <775b8d190902230531w41cf6724y7a852224806fe1bf@mail.gmail.com> From: Bruce Ellis To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] actionfs Topicbox-Message-UUID: a616ec92-ead4-11e9-9d60-3106f5b1d025 to make "score" i converted over 30,000 frames from mpg to tiff, using inferno. it took a while, as it was 10 years ago, but nice to wake up to. brucee On Mon, Feb 23, 2009 at 11:13 AM, wrote: > 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 =3D $1 > shift > > echo $* > /fd/$fd > > ----- > > The coresponding action-write also works > > > ---- > #!/bin/rc > > fd =3D $1 > shift > > cat /fd/$fd > /dev/null # or whatever > > ----- > > I wrote it specifically to extract individual frames from video files usi= ng ffmpeg on Linux and > bring them into Plan9 for processing but generalized the arguments in cas= e 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 =3D `{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 =3D `{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 (someti= mes) > } >[2] /dev/null > > > I was then using imgfs to calculate the average rgb value to look for bla= ck frames but (unsurprisingly) it was taking too long (4 secs per frame) es= p. as the Plan9 I was using is in Qemu, cue installing Plan 9 on my termina= l. > > The ffmpeg part on the Linux side (2Ghz Opteron) was taking 1 second on i= ts own so I have to come up with some sort of look ahead cache which is con= trary 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 > >