[Interest] Faster way of rendering QOpenGLFramebufferObject to image

Nuno Santos nuno.santos at imaginando.pt
Wed Jul 14 22:00:17 CEST 2021


João,

Thanks for the tip. Will search about it.

Best,

Nuno

> On 14 Jul 2021, at 20:22, joao morgado via Interest <interest at qt-project.org> wrote:
> 
> 
> Hello Nuno
> 
> Not sure if it helps, but the book Anton's OpenGL 4 Tutorials has a chapter about recording a video from OpenGL. It's the same approach you are doing, saving images from a frame buffer at certain fixed rate. I just dont know what kinf of optimisations are done, I didnt read it with much attention.
> 
> Cheers
> João
> 
> 
> Em terça-feira, 13 de julho de 2021 14:33:42 GMT+1, Nuno Santos <nuno.santos at imaginando.pt> escreveu:
> 
> 
> Elvis,
> 
> Thanks for sharing your thoughts. It makes sense.
> 
> I need to dive into the toImage function, try to read directly the bytes from the FBO and see if that has any performance impact.
> 
> Best regards,
> 
> Nuno
> 
> > On 13 Jul 2021, at 14:10, Elvis Stansvik <elvstone at gmail.com <mailto:elvstone at gmail.com>> wrote:
> > 
> > Hi Nuno,
> > 
> > I'm really out of my waters here, but, provided you don't need to hold
> > on to each AVFrame after you are "done with it", you could perhaps
> > avoid having to allocate a QImage for each frame (which toImage forces
> > you to do) by just allocating a a single AVFrame and a single memory
> > buffer for it, and then do what toImage does, which is make sure the
> > FBO is bound and read the pixels off of it with glReadPixels. Then you
> > could read the pixels straight into the memory buffer used by your
> > AVFrame.
> > 
> > That way you would save the overhead of a new QImage being allocated
> > each time, which might speed things up..?
> > 
> > Just ideas here. Have not worked with GL or ffmpeg before.
> > 
> > Elvis
> > 
> > Den tis 13 juli 2021 kl 11:22 skrev Nuno Santos <nuno.santos at imaginando.pt <mailto:nuno.santos at imaginando.pt>>:
> >> 
> >> Hi,
> >> 
> >> I’m trying to capture the content of an FBO to a video file. This video file should contain the animations generated by a qml scene.
> >> 
> >> To do this, I’m recurring to QOpenGLFramebufferObject class toImage() method.
> >> 
> >> My scene is being drawn at 1920x1080. Each call to toImage takes 30 ms! :(
> >> 
> >> If I want to render to file at 60 fps, ideally, this call would need to take less than 16 ms to give me room to do other operations, such as video encoding and the actual render.
> >> 
> >> As anyone been here before? What other strategies are available to copy the FBO data to an image?
> >> 
> >> I’m using libav to encode the video file, therefor I need to fill an AVFrame. Right now I’m filling the AVFrame from the QImage generated by the FBO toImage method.
> >> 
> >> Does any one knows a method of filling an AVFrame directly from texture data?
> >> 
> >> Thanks
> >> 
> >> Best regards,
> >> 
> >> Nuno
> >> _______________________________________________
> >> Interest mailing list
> >> Interest at qt-project.org <mailto:Interest at qt-project.org>
> >> https://lists.qt-project.org/listinfo/interest <https://lists.qt-project.org/listinfo/interest>
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org <mailto:Interest at qt-project.org>
> https://lists.qt-project.org/listinfo/interest <https://lists.qt-project.org/listinfo/interest>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210714/5bc93cdf/attachment.html>


More information about the Interest mailing list