fzwoch / obs-vaapi

OBS Studio VAAPI support via GStreamer
GNU General Public License v2.0
118 stars 3 forks source link

No encoders found on Intel iGPU #13

Closed Sid127 closed 1 year ago

Sid127 commented 1 year ago

The plugin throws these in the logs on launch:

info: [obs-vaapi] version: 0.2.0, gst-runtime: 1.22.3
info: [obs-vaapi] H.264 encoder - not found
info: [obs-vaapi] H.264 encoder (low power) - not found
info: [obs-vaapi] H.265 encoder - not found
info: [obs-vaapi] H.265 encoder (low power) - not found
info: [obs-vaapi] AV1 encoder - not found
info: [obs-vaapi] AV1 encoder (low power) - not found
info: [obs-vaapi] H.264 encoder (legacy) - not found
info: [obs-vaapi] H.265 encoder (legacy) - not found

Despite my device being set up correctly

[sidpr@strogg ~]$ vainfo
Trying display: wayland
vainfo: VA-API version: 1.19 (libva 2.18.2)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
[sidpr@strogg ~]$ gst-inspect-1.0 va
Plugin Details:
  Name                     va
  Description              VA-API codecs plugin
  Filename                 /usr/lib/gstreamer-1.0/libgstva.so
  Version                  1.22.3
  License                  LGPL
  Source module            gst-plugins-bad
  Documentation            https://gstreamer.freedesktop.org/documentation/va/
  Source release date      2023-05-19
  Binary package           Arch Linux gst-plugins-bad 1.22.3-6.1
  Origin URL               https://www.archlinux.org/

  vacompositor: VA-API Video Compositor
  vadeinterlace: VA-API Deinterlacer
  vah264dec: VA-API H.264 Decoder
  vah265dec: VA-API H.265 Decoder
  vampeg2dec: VA-API Mpeg2 Decoder
  vapostproc: VA-API Video Postprocessor
  varenderD128h264dec: VA-API H.264 Decoder in renderD128
  varenderD128h264enc: VA-API H.264 Encoder in renderD128
  varenderD128h264lpenc: VA-API H.264 Low Power Encoder in renderD128
  varenderD128h265dec: VA-API H.265 Decoder in renderD128
  varenderD128h265enc: VA-API H.265 Encoder in renderD128
  varenderD128jpegdec: VA-API JPEG Decoder in renderD128
  varenderD128mpeg2dec: VA-API Mpeg2 Decoder in renderD128
  varenderD128vp8dec: VA-API VP8 Decoder in renderD128
  varenderD128vp9dec: VA-API VP9 Decoder in renderD128
  vavp8dec: VA-API VP8 Decoder
  vavp9dec: VA-API VP9 Decoder

  17 features:
  +-- 17 elements
fzwoch commented 1 year ago

The encoder names seem to be vastly different and tied to the devices they represent. It may be the new way how to select between devices. Looks like we need a more generic approach to register encoders. I wonder why I'm not seeing this name scheme myself though..

fzwoch commented 1 year ago

If you can give this branch a try:

https://github.com/fzwoch/obs-vaapi/tree/encoder_iteration

Sid127 commented 1 year ago

I was just about to head to bed, I'll give it a go in ~12 hours :)

------- Original Message ------- On Tuesday, June 20th, 2023 at 12:36 AM, Florian Zwoch @.***> wrote:

If you can give this branch a try:

https://github.com/fzwoch/obs-vaapi/tree/encoder_iteration

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Sid127 commented 1 year ago

Yup, that branch works well!

info: [obs-vaapi] version: 0.2.0-6-gd68115f, gst-runtime: 1.22.3
info: [linux-vkcapture] Client 1 connected (pid=13825)
info: [obs-vaapi] found varenderD128h264lpenc  
info: [obs-vaapi] found varenderD128h264enc
info: [obs-vaapi] found varenderD128h265enc
fzwoch commented 1 year ago

Great, I hope the encodes are also working?

Sid127 commented 1 year ago

sorry 😅 H264 seems to be working fine, but selecting HEVC in the recording settings results in a segfault.

(gdb) bt
#0  0x00007fe8b5bbbb85 in g_object_class_install_properties () at /usr/lib/libgobject-2.0.so.0
#1  0x00007fe79cfd1980 in  () at /usr/lib/gstreamer-1.0/libgstva.so
#2  0x00007fe8b5bdcd0f in g_type_class_ref () at /usr/lib/libgobject-2.0.so.0
#3  0x00007fe8b5bc44e3 in g_object_new_with_properties () at /usr/lib/libgobject-2.0.so.0
#4  0x00007fe81730b5a5 in gst_element_factory_create_with_properties () at /usr/lib/libgstreamer-1.0.so.0
#5  0x00007fe81730bf15 in gst_element_factory_make_with_properties () at /usr/lib/libgstreamer-1.0.so.0
#6  0x00007fe8369ac8f5 in  () at /usr//lib/obs-plugins/obs-vaapi.so
#7  0x00007fe8b7cde986 in obs_encoder_defaults () at /usr/lib/libobs.so.0
#8  0x0000562f78f8400d in  ()
#9  0x0000562f78f8c3ae in  ()
#10 0x0000562f78e311a0 in  ()
#11 0x00007fe8b577ba7c in  () at /usr/lib/libQt6Core.so.6
#12 0x00007fe8b6a21ff9 in  () at /usr/lib/libQt6Widgets.so.6
#13 0x00007fe8b6a2550a in  () at /usr/lib/libQt6Widgets.so.6
#14 0x00007fe8b6a2b32f in  () at /usr/lib/libQt6Widgets.so.6
#15 0x00007fe8b577bc0b in  () at /usr/lib/libQt6Core.so.6
#16 0x00007fe8b6a21d87 in QComboBoxPrivateContainer::itemSelected(QModelIndex const&) () at /usr/lib/libQt6Widgets.so.6
#17 0x00007fe8b6a2105e in QComboBoxPrivateContainer::eventFilter(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#18 0x00007fe8b571e688 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#19 0x00007fe8b68f355b in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#20 0x00007fe8b68f5e9a in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#21 0x00007fe8b571fbe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#22 0x00007fe8b68f1447 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt6Widgets.so.6
#23 0x00007fe8b6957550 in  () at /usr/lib/libQt6Widgets.so.6
#24 0x00007fe8b695831d in  () at /usr/lib/libQt6Widgets.so.6
#25 0x00007fe8b68f356b in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#26 0x00007fe8b571fbe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#27 0x00007fe8b5d7d1d0 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt6Gui.so.6
#28 0x00007fe8b5dea6bc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Gui.so.6
#29 0x00007fe8b621ad14 in  () at /usr/lib/libQt6Gui.so.6
#30 0x00007fe8b4310981 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#31 0x00007fe8b436db39 in  () at /usr/lib/libglib-2.0.so.0
#32 0x00007fe8b430e032 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#33 0x00007fe8b5939db4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#34 0x00007fe8b5729ec3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#35 0x00007fe8b6b41a6b in QDialog::exec() () at /usr/lib/libQt6Widgets.so.6
#36 0x0000562f78f2aaf1 in  ()
#37 0x0000562f78e34b97 in  ()
#38 0x00007fe8b577ba7c in  () at /usr/lib/libQt6Core.so.6
#39 0x00007fe8b6a09bea in  () at /usr/lib/libQt6Widgets.so.6
#40 0x00007fe8b6a0a1e8 in  () at /usr/lib/libQt6Widgets.so.6
#41 0x00007fe8b6a0a33d in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt6Widgets.so.6
#42 0x00007fe8b6940339 in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#43 0x00007fe8b68f356b in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#44 0x00007fe8b68f5e9a in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#45 0x00007fe8b571fbe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#46 0x00007fe8b68f1447 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt6Widgets.so.6
#47 0x00007fe8b6956ffc in  () at /usr/lib/libQt6Widgets.so.6
#48 0x00007fe8b695831d in  () at /usr/lib/libQt6Widgets.so.6
#49 0x00007fe8b68f356b in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#50 0x00007fe8b571fbe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#51 0x00007fe8b5d7d1d0 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt6Gui.so.6
#52 0x00007fe8b5dea6bc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Gui.so.6
#53 0x00007fe8b621ad14 in  () at /usr/lib/libQt6Gui.so.6
#54 0x00007fe8b4310981 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#55 0x00007fe8b436db39 in  () at /usr/lib/libglib-2.0.so.0
#56 0x00007fe8b430e032 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#57 0x00007fe8b5939db4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#58 0x00007fe8b5729ec3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#59 0x00007fe8b57234f8 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6
#60 0x0000562f78e24760 in main ()
fzwoch commented 1 year ago

Can you make it run with a debug version of the plugin? That way we can at least see on which line the plugin makes it crash. Iirc "it did work in my test" (tm).

But it is also possible that your device exposes more options than mine which runs into an unhandled case.

Also post the output of gst-inspect-1.0 varenderD128h265enc.

Can also be something within Gstreamer itself. The stack trace is quite deep in their territory too..

Sid127 commented 1 year ago

...strange, built with --buildtype=debug, and the HEVC codec works fine now. Still attaching the output of that gst-inspect command gst.log

fzwoch commented 1 year ago

Could be a hint it is still some bug. I will have to test on my end.

I wonder with -buildtype=debugoptimized makes a difference.

fzwoch commented 1 year ago

I can't seem to replicate on my end though :/

fzwoch commented 1 year ago

Merged anyway. The calls tack suggests the crash is happening when instantiating the encoder. This should either succeed or fail. So I assume this is a va plugin error of GStreamer until more info hints otherwise.