我正在尝试在 Ubuntu 18.04 上将 VAAPI 与 Gstreamer 一起使用来编码 H.264。我很确定我已经安装了所有必要的软件包(gstreamer1.0-vaapi, vainfo, i965-va-driver
以及所有依赖项)。
VAAPI 已启用并且可以工作:
$ 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
所以VAAPI在那里并且支持H.264。Gstreamer 还具有 VAAPI 支持:
$ 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
然而,明显缺席的是vaapih264enc
。AFAICT 它甚至被编译到包中:
$ 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
[...]
那么我需要做什么才能真正启用相应的 Gstreamer 元素呢?