From owner-freebsd-multimedia Wed Jan 5 22:50:15 2000 Delivered-To: freebsd-multimedia@freebsd.org Received: from alpha.netvision.net.il (alpha.netvision.net.il [194.90.1.13]) by hub.freebsd.org (Postfix) with ESMTP id 5F96315570 for ; Wed, 5 Jan 2000 22:50:08 -0800 (PST) (envelope-from ak@freenet.co.uk) Received: from freenet.co.uk (RAS2-p81.rlz.netvision.net.il [62.0.168.205]) by alpha.netvision.net.il (8.9.3/8.8.6) with ESMTP id IAA26131; Thu, 6 Jan 2000 08:49:43 +0200 (IST) Message-ID: <38743BA1.C439154D@freenet.co.uk> Date: Thu, 06 Jan 2000 06:52:17 +0000 From: Alex X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.0-CURRENT i386) X-Accept-Language: en MIME-Version: 1.0 To: Tim Pozar Cc: freebsd-multimedia@FreeBSD.ORG, Amancio Hasty Subject: Re: an FXTV suggestion References: <38718545.451AE46F@mos.net> <20000105171550.A14765@ipass.net> <3873CED1.22BD498F@mos.net> <20000105164531.A88681@lns.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Tim Pozar wrote: > > On Thu, Jan 06, 2000 at 02:08:02AM +0300, Alexei Khalimov wrote: > > Randall Hopper wrote: > > > > > What you want is a batch capture tool. What Fxtv is is an interactive GUI > > > application. These should be a separate apps. > > > > > > [[ I've seen this discussion before, with other tools. First is the > > > request for batch capabilities, then the complaint from someone else that > > > doesn't even run X that they have to have X installed (allocate disk space > > > for it, download the packages, etc.), not just to compile their batch app, > > > but to run it. The complaint is certainly justified. ]] > > > > Well, I would be happy with something like > > fxtv -batchsave /tmp/webcam.ppm -period 60 > > which will save single frame to that file every 60sec > > or save one and exit when called without -period > > (all this without starting GUI) > > > > it should not be hard to code it... > > I did this way back when (~'93) with Sun's VideoPix video frame > grabber device (/dev/vfc0). Cron would launch the program every > minute and the code would then opened the device, set the format > (size, video format, color, etc), grab a frame and spit out a YUV > image. At that point I would run PBM to clean it up and spit out > a (then) GIF image. > > Is there something like a frame grabber device for the 848 cards > that could be managed in much the same manner? Yes, that's exactly what /dev/bktr0 is for. You open the device, set the format (using the various ioctl's in ), then mmap the device, and you can start grabbing frames from the mmapped memory location. If you want a real *live* webcam (continuous capture), forget about saving images to the disk, use SysV IPC instead. You need a webcam server program that first allocates a shared memory location, and then continuously jpegs captured frames into that location (the jpeg library can do that very well). Then you have a client application that reads images from shared memory and sends them to the client. The only way to do that continuously (that I know of) is to use Netscape's "server-push". MSIE didn't support server-push two years ago, maybe they do now. You have to use semaphores to lock access to your shared memory while the server is updating it, and while a client is reading from it. This method worked very well for me in the past, with multiple clients. CPU consumption generally depends on how often you update the image, its size and JPEG quality. On a Pentium 200, with continuous updates, size 320x240 and a quality of 50, the server consumed about 50-90% of CPU time, while the clients used only about 0.01% each. The server was coded to do nothing if there were no clients requesting data. Obviously due to memory locks, the more clients you have, the less often the server updates the image (and therefore consumes less CPU, which I find rather amusing :). The maximal number of clients I had tested it with was about a 100, but I'm sure it can handle a lot more. The reason the clients are so lightweight is because compression, a CPU-intensive task, is done by the server; all a client has to do is 1) lock memory, 2) copy the data into its own buffer, 3) unlock memory, 4) send the data. The copying of the data into a buffer is important to avoid locking the shared memory for long periods of time (while the data are being sent across the network). That's all there is to it. Alex To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message