Headless VA-API hardware accelerated H.264 video encoding with vaapih264enc?

Víctor Jáquez vjaquez at igalia.com
Fri Sep 14 09:29:38 UTC 2018


Hi

On Fri, 14 Sep 2018 at 06:00, Matthew Thyer wrote:
> The Libav Wiki "Hardware/vaapi" page (https://wiki.libav.org/Hardware/vaapi)
> states that I should be able to use VA-API hardware acceleration without being
> connected to an X server.
> 
> Quote:
> "The libva driver needs to be attached to a DRM device to work. This
> can be connected either directly or via a running X server. When working
> standalone, it is generally best to use a DRM render node (/dev/dri/render*);
> only use a connection via X if you actually want to deal with surfaces inside
> X (with DRI2, for example)."
> 
> It then gives an example on how to use the DRI rendering device directly with
> the "avconv" utility: avconv -hwaccel vaapi -hwaccel_device
> /dev/dri/renderD128 -i ...
> 
> What's the equivalent for the vaapih264enc GStreamer element?  i.e., How do I
> make it use the DRM device /dev/dri/renderD128 instead of the X server?  I
> can't see any properties of the element that allow me to control this.

vaapih264enc will try to find a usable libva connection by querying other
elements in the pipeline (via gstcontext), and the application later. If there
is not reply, the vaapi element will iterate a list of possible of connection in
a trial-and-error manner.

When the DRM is chosen, it will also iterate over the render nodes available
until it find one suitable for VAAPI.

So, if you want to use the DRM connection, you could either

1) run the pipeline without any window environment:

   $ DISPLAY= WAYLAND_DISPLAY= gst-launch-1.0 videotestsrc num-buffers=100 ! vaapih264enc ! fakesink --gst-debug=vaapidisplay:5

And you'll see the created display GstVaapiDisplayDRM

2) *this is no implemented yet for DRM, only for X11 and Wayland* the
application can create it's own vaDisplay and can pass it to the pipeline along
with the used dri device.

vmjl


More information about the gstreamer-devel mailing list