On Oct 31, 2011, at 4:08 PM, Aaron San Filippo wrote:
> 
> What I'm trying to do: I'm capturing openGL framebuffer output each frame, 
> from a plugin in a cross-platform 3D engine. 
> At the moment I'm capturing each frame as a simple BGR buffer. Maybe there's 
> a trivial raw output format I could write to and then pass to libav in one 
> shot? best performance is important here as this is a process that will run 
> on a server that we pay by the hour for, so I'm assuming that writing a 
> sequence of images and then reading from that would be sub-optimal. But 
> perhaps that's a faulty assumption.

Have a look at the code here (part of libavg):

http://www.libavg.de/browser/trunk/libavg/src/player/VideoWriter.cpp and 
http://www.libavg.de/browser/trunk/libavg/src/player/VideoWriterThread.cpp

It downloads buffers from the graphics card and forwards them to a second 
thread that writes them to disk using libav, so everything runs in parallel. 
This takes next to zero time on the rendering thread :-). The output format we 
use is MJPEG, which doesn't take much CPU power to compress.

As bonus, there is a code path that does color space conversion to YUV on the 
GPU, saving you more than 50% of the compression time.

Of course, you'll have to extract the relevant parts of the code...

Cheers,

  Uli

--
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: [email protected]
Skype: uzadow

_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to