2

I'm trying to use VAAPI with Gstreamer on Ubuntu 18.04 to encode H.264. I'm pretty sure I have all necessary packages installed (gstreamer1.0-vaapi, vainfo, i965-va-driver and all dependencies).

VAAPI is enabled and works:

 $ vainfo
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD

So VAAPI is there and supports H.264. Gstreamer also has VAAPI support:

$ gst-inspect-1.0 vaapi
Plugin Details:
  Name                     vaapi
  Description              VA-API based elements
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so
  Version                  1.14.5
  License                  LGPL
  Source module            gstreamer-vaapi
  Source release date      2019-05-29
  Binary package           gstreamer-vaapi
  Origin URL               http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

  vaapisink: VA-API sink
  vaapidecodebin: VA-API Decode Bin
  vaapipostproc: VA-API video postprocessing
  vaapimpeg2dec: VA-API MPEG2 decoder

  4 features:
  +-- 4 elements

However, what's conspicuously absent is vaapih264enc. AFAICT it's even compiled into the package:

$ strings /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so | grep h264
gst_h264_nal_parser_free
gst_h264_parser_parse_sps
[...]
vaapih264feienc
vaapih264enc
video/x-h264
[...]

So what do I have to do to actually enable the corresponding Gstreamer element?

Florian Echtler
  • 2,148
  • 1
  • 15
  • 28
  • 1
    Not sure about the type of hardware and driver version.. However gst-vaapi has a whitelisting for driver support. Try `GST_VAAPI_ALL_DRIVERS=1 gst-inspect-1.0 vaapi` to see if it lists more components. – Florian Zwoch Dec 18 '19 at 12:44
  • Thanks for the suggestion, but `GST_VAAPI_ALL_DRIVERS=1` doesn't make a difference unfortunately. Driver is 2.1.0 on a Core i5-4310M. I'll try a different machine and see if it works there. – Florian Echtler Dec 18 '19 at 19:56
  • There is a faint memory. Depending on distribution I guess - on Debian I have installed `i965-va-driver-shaders` instead of `i965-va-driver`. I think it includes some non-free but required stuff to decode certain codecs. – Florian Zwoch Dec 18 '19 at 21:48
  • 1
    You can try removing gst cache `rm ~/.cache/gstreamer-1.0/*` and then running `gst-inspect-1.0 -b` again to see if it's not being blacklisted. – Michal Przybylowicz Apr 30 '20 at 21:10
  • Thanks for the suggestion, but still only four elements, no H264 decoder. – Florian Echtler May 02 '20 at 10:25

0 Answers0