Issues with VAAPI and OpenGL
Marianna Smidth Buschle
msb at qtec.com
Wed Feb 16 07:50:08 UTC 2022
> Hello,
>
> In my C++ application, I need to transfer a decoded VASurface in a
> GLTexture, using glupload and a custom appsink, for 3D rendering
> purpose.
> Ideally, I would like a solution with zero-copy texture transfer from
> VASurface to OpenGL, directly in NV12 format.
> However, I've difficulties using VAAPI+OpenGL+GStreamer. For example,
> the following pipeline doesn't work :
>
> gst-launch-1.0 urisourcebin uri=file:///home/myusername/myvideo.mp4 !
> qtdemux ! vaapidecodebin ! glupload ! glcolorconvert ! glimagesink
>
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> Got context from element 'sink': gst.gl.GLDisplay=context,
> gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0";
> Got context from element 'vaapipostproc0': gst.vaapi.Display=context,
> gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayGLX\)\
> vaapidisplayglx0";
> Redistribute latency...
> ERROR: from element
> /GstPipeline:pipeline0/GstURISourceBin:urisourcebin0/GstTypeFindElement:typefindelement0:
> Internal data stream error.
> Additional debug info:
> gsttypefindelement.c(1228): gst_type_find_element_loop ():
> /GstPipeline:pipeline0/GstURISourceBin:urisourcebin0/GstTypeFindElement:typefindelement0:
> streaming stopped, reason not-negotiated (-4)
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> Freeing pipeline ...
>
> This pipeline is also giving the same result :
> gst-launch-1.0 urisourcebin uri=file:///home/myusername/myvideo.mp4 !
> qtdemux ! vaapidecodebin !
> "video/x-raw(meta:GstVideoGLTextureUploadMeta),format=RGBA" ! glupload !
> glcolorconvert ! glimagesink
>
> Meanwhile, the following pipelines are working, but are usable for my
> project :
>
> gst-launch-1.0 urisourcebin uri=file:///home/myusername/myvideo.mp4 !
> qtdemux ! vaapidecodebin ! "video/x-raw,format=NV12" ! glupload !
> glcolorconvert ! glimagesink (non zero-copy)
> gst-launch-1.0 urisourcebin uri=file:///home/myusername/myvideo.mp4 !
> qtdemux ! vaapidecodebin ! vaapisink (not using OpenGL)
>
> Do you have any idea why the first pipeline is not working ?
> I'm using Ubuntu 20.04, and the following version of GStreamer :
> gst-launch-1.0 version 1.16.2
> GStreamer 1.16.2
> https://launchpad.net/distros/ubuntu/+source/gstreamer1.0
reason not-negotiated (-4)
So you need to debug the CAPS.
Try running with GST_DEBUG=*:3,GST_CAPS:5
And see if you can figure out which CAPS are incompatible.
Then you might want to try adding some elements with can convert/parse
to get the right CAPS, fx 'vaapipostproc' might help.
But I'm not sure if you can get zero copy.
> Here is the result of gst-inspect on vaapidecodebin, for the src part.
> I'm wondering why there is not DMABuf capabilities and why
> GstVideoGLTextureUploadMeta is limited to RGBA format
I can see several issues in Gitlab about DMA, fx:
https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/267
https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/207
https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/105
--
Best regards / Med venlig hilsen
“Marianna Smidth Buschle”
More information about the gstreamer-devel
mailing list