I have implemented a class that does this multithreaded imagecapture and it works fairly well. It was adopted to osgProducer so I have to verify that it also works for osgViewer. It generates screens as images and pushes them to a worker that write bmp:s to disk.
Then I use bmp2avi (under windows to generate avi:s, or the Bink/Smacker toolset to generate them). I will verify the code with latest osg and post it back.... /Anders On 8/13/07, Robert Osfield <[EMAIL PROTECTED]> wrote: > > I haven't put together a video from an OSG app yep, but its inevitable > one day I'll need to so I thought I'd pen down what I think might be a > nice way to tackle it. This might also be a good example to have > added to the OSG, so users are welcome to add one :-) > > My thought was to have a slave Camera that tracks the master camera, > but with an FBO or Pbuffer set to PAL dimensions (or whatever target > res you want for the video), this will record the frames at the > correct size, and without any toolboxes etc interfering. > > Second up would be to attach a post draw callback to the slave Camera, > and in this callback you'd do the osg::Image::readPixels to do this > for you. In theory one could set up a PixelBufferObject to help speed > to read up. Next up you have to save this image to disk, or just > cache it. Now writing to disk will be slow, so you don't want to do > this in the rendering thread, rather spawn an OperationThread to do > the writing to disk, with a custom ImageWriteOperation added to the > OperationThread. Due to the asynchronous nature of write one will > need to use a circular buffer of osg::Image, one at the head being > written to by the rendering thread, and the rest being used by > ImageWriteOperations, when the image is written to disk one simply > then put the Image back into the buffer ready to be reused. > > Then once you've stopped your recording of images, you wait till the > last frame is written to disk (the OperationThread's queue is empty) > then you span a tool to glue all these frames together as a video. > Potentially you could use video library like ffmpeg to do this in a > background thread. > > Other little changes one could make would be to cut the framerate of > the app down to 25fps to match the needs of the video, or perhaps even > let the app run at a multiple, say 50 or 75fps and then blend frames > together, and only write out at 25fps. > > Robert. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- ________________________________________________________________ Anders Backman Email: [EMAIL PROTECTED] HPC2N/VRlab Phone: +46 (0)90-786 9936 Umea university Cellular: +46 (0)70-392 64 67 S-901 87 UMEA SWEDEN Fax: +46 90-786 6126 http://www.cs.umu.se/~andersb
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

