Is it possible to send OpenGL framebuffer direct to nvh264enc?

classic Classic list List threaded Threaded
3 messages Options
F32
Reply | Threaded
Open this post in threaded view
|

Is it possible to send OpenGL framebuffer direct to nvh264enc?

F32
Hi,

Suppose we have a video game based on OpenGL and we have its source code. In order to capture game video, we can call glReadPixels() before swapping buffer, and then send the pixels to gstreamer's nvenc plugin. In this way, the frame is first sent from GPU memory to system memory, and then to GPU again, which seems to be unnecessary.

Is it possible to send the frame buffer direct to nvenc, so that there's no extra glupload / gldownload?

Regards
Windy


 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to send OpenGL framebuffer direct to nvh264enc?

Michael Gruner
I believe NVIDIA elements may consume EGLStreams directly, avoiding the copy. You’ll have to add the support yourself though. In some platforms you’ll even need to deal with memory layouts, aka Block Linear vs Pitch Linear.

On May 19, 2020, at 21:24, F32 <[hidden email]> wrote:


Hi,

Suppose we have a video game based on OpenGL and we have its source code. In order to capture game video, we can call glReadPixels() before swapping buffer, and then send the pixels to gstreamer's nvenc plugin. In this way, the frame is first sent from GPU memory to system memory, and then to GPU again, which seems to be unnecessary.

Is it possible to send the frame buffer direct to nvenc, so that there's no extra glupload / gldownload?

Regards
Windy


 

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to send OpenGL framebuffer direct to nvh264enc?

Matthew Waters
In reply to this post by F32
The nvidia encoding elements nv*enc can consume video/x-raw(memory:GLMemory) formatted buffers.  The restriction for them is that the GLMemory buffers you create must be from the GstGLMemoryPBO allocator to allow for access to the PBO object for the copy to the cuda memory.

This of course only works from a nvenc element created from a cuda context and as such may not work on windows.

Cheers
-Matt

On 20/5/20 1:09 pm, F32 wrote:
Hi,

Suppose we have a video game based on OpenGL and we have its source code. In order to capture game video, we can call glReadPixels() before swapping buffer, and then send the pixels to gstreamer's nvenc plugin. In this way, the frame is first sent from GPU memory to system memory, and then to GPU again, which seems to be unnecessary.

Is it possible to send the frame buffer direct to nvenc, so that there's no extra glupload / gldownload?

Regards
Windy


 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (499 bytes) Download Attachment