univrsal / input-overlay

Show keyboard, gamepad and mouse input on stream
GNU General Public License v2.0
2.85k stars 239 forks source link

Unable to run with snap package version of OBS-Studio #93

Closed thomasfinstad closed 4 years ago

thomasfinstad commented 4 years ago

Describe the bug With the snap package version of OBS-Studio the libuiohook.so.0 library will have no valid place to load from. Snap packages install to a readonly filesystem that you can not add files to, this is for security/sandboxing.

To Reproduce

  1. Depending on distro: apt install snapd
  2. snap install obs-studio
  3. cd ~/snap/obs-studio/current/.config/obs-studio
  4. mkdir -p plugins/input-overlay && cd plugins/input-overlay
  5. wget https://github.com/univrsal/input-overlay/releases/download/v4.8/input-overlay.v4.8b.linux64.zip
  6. unzip input-overlay.v4.8b.linux64.zip
  7. rm LICENSE.txt input-overlay.v4.8b.linux64.zip README.txt
  8. mv plugin/* ./
  9. Open obs
  10. Help -> Log Files -> View Current Log

kl. 04.45 +0100.449: os_dlopen(/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so->/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so): libuiohook.so.0: cannot open shared object file: No such file or directory kl. 04.45 +0100.449: kl. 04.45 +0100.449: Module '/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so' not loaded

Expected behavior If the library is included and loaded from a known path in the plugin folder the issue should go away.

Screenshots N / A

Additional information:

kl. 04.45 +0100.086: Command Line Arguments: --startreplaybuffer kl. 04.45 +0100.105: CPU Name: AMD Ryzen 5 2600X Six-Core Processor kl. 04.45 +0100.105: CPU Speed: 3174.777MHz kl. 04.45 +0100.106: Physical Cores: 6, Logical Cores: 12 kl. 04.45 +0100.106: Physical Memory: 16030MB Total, 2961MB Free kl. 04.45 +0100.106: Kernel Version: Linux 5.0.0-31-generic kl. 04.45 +0100.106: Distribution: "Ubuntu Core" "18" kl. 04.45 +0100.107: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.4 kl. 04.45 +0100.108: Portable mode: false kl. 04.45 +0100.191: OBS 24.0.3 (linux) kl. 04.45 +0100.191: --------------------------------- kl. 04.45 +0100.192: --------------------------------- kl. 04.45 +0100.192: audio settings reset: kl. 04.45 +0100.192: samples per sec: 48000 kl. 04.45 +0100.192: speakers: 2 kl. 04.45 +0100.196: --------------------------------- kl. 04.45 +0100.196: Initializing OpenGL... kl. 04.45 +0100.343: Loading up OpenGL on adapter NVIDIA Corporation GeForce GTX 1070 Ti/PCIe/SSE2 kl. 04.45 +0100.343: OpenGL loaded successfully, version 3.2.0 NVIDIA 430.50, shading language 1.50 NVIDIA via Cg compiler kl. 04.45 +0100.354: --------------------------------- kl. 04.45 +0100.354: video settings reset: kl. 04.45 +0100.354: base resolution: 2560x1440 kl. 04.45 +0100.354: output resolution: 2560x1440 kl. 04.45 +0100.354: downscale filter: Bicubic kl. 04.45 +0100.354: fps: 60/1 kl. 04.45 +0100.354: format: NV12 kl. 04.45 +0100.354: YUV mode: 601/Partial kl. 04.45 +0100.354: NV12 texture support not available kl. 04.45 +0100.354: Audio monitoring device: kl. 04.45 +0100.354: name: Default kl. 04.45 +0100.354: id: default kl. 04.45 +0100.354: --------------------------------- kl. 04.45 +0100.355: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so' kl. 04.45 +0100.438: No blackmagic support kl. 04.45 +0100.444: NVENC supported kl. 04.45 +0100.444: FFMPEG VAAPI supported kl. 04.45 +0100.449: VLC found, VLC video source enabled kl. 04.45 +0100.449: os_dlopen(/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so->/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so): libuiohook.so.0: cannot open shared object file: No such file or directory kl. 04.45 +0100.449: kl. 04.45 +0100.449: Module '/home/thomas/snap/obs-studio/731/.config/obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so' not loaded kl. 04.45 +0100.449: --------------------------------- kl. 04.45 +0100.449: Loaded Modules: kl. 04.45 +0100.449: vlc-video.so kl. 04.45 +0100.449: text-freetype2.so kl. 04.45 +0100.449: rtmp-services.so kl. 04.45 +0100.449: obs-x264.so kl. 04.45 +0100.449: obs-transitions.so kl. 04.45 +0100.449: obs-outputs.so kl. 04.45 +0100.449: obs-libfdk.so kl. 04.45 +0100.449: obs-filters.so kl. 04.45 +0100.449: obs-ffmpeg.so kl. 04.45 +0100.449: linux-v4l2.so kl. 04.45 +0100.449: linux-pulseaudio.so kl. 04.45 +0100.449: linux-jack.so kl. 04.45 +0100.449: linux-decklink.so kl. 04.45 +0100.449: linux-capture.so kl. 04.45 +0100.449: linux-alsa.so kl. 04.45 +0100.449: image-source.so kl. 04.45 +0100.449: frontend-tools.so kl. 04.45 +0100.449: decklink-ouput-ui.so kl. 04.45 +0100.449: --------------------------------- kl. 04.45 +0100.449: ==== Startup complete =============================================== kl. 04.45 +0100.452: All scene data cleared kl. 04.45 +0100.452: ------------------------------------------------ kl. 04.45 +0100.455: pulse-input: Server name: 'pulseaudio 12.2' kl. 04.45 +0100.456: pulse-input: Audio format: s32le, 48000 Hz, 2 channels kl. 04.45 +0100.456: pulse-input: Started recording from 'alsa_output.pci-0000_08_00.3.analog-stereo.monitor' kl. 04.45 +0100.456: pulse-input: Server name: 'pulseaudio 12.2' kl. 04.45 +0100.456: pulse-input: Audio format: s16le, 48000 Hz, 2 channels kl. 04.45 +0100.456: pulse-input: Started recording from 'alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo' kl. 04.45 +0100.459: pulse-input: Server name: 'pulseaudio 12.2' kl. 04.45 +0100.460: pulse-input: Audio format: float32le, 48000 Hz, 2 channels kl. 04.45 +0100.460: pulse-input: Started recording from 'CommNullSink.monitor' kl. 04.45 +0100.460: pulse-input: Server name: 'pulseaudio 12.2' kl. 04.45 +0100.461: pulse-input: Audio format: float32le, 48000 Hz, 2 channels kl. 04.45 +0100.461: pulse-input: Started recording from 'GameNullSink.monitor' kl. 04.45 +0100.468: xshm-input: Geometry 2560x1440 @ 2560,0 kl. 04.45 +0100.476: xshm-input: Geometry 2560x1440 @ 0,8 kl. 04.45 +0100.482: xshm-input: Geometry 2560x1440 @ 5120,0 kl. 04.45 +0100.483: Switched to scene 'ingame' kl. 04.45 +0100.483: ------------------------------------------------ kl. 04.45 +0100.483: Loaded scenes: kl. 04.45 +0100.483: - scene 'ingame': kl. 04.45 +0100.484: - source: 'Game Audio' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - source: 'Voice Comms' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - filter: 'Compressor' (compressor_filter) kl. 04.45 +0100.484: - filter: 'Noise Suppression' (noise_suppress_filter) kl. 04.45 +0100.484: - source: 'Csgo Video' (xcomposite_input) kl. 04.45 +0100.484: - scene 'desktop main': kl. 04.45 +0100.484: - source: 'Game Audio' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - source: 'Voice Comms' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - filter: 'Compressor' (compressor_filter) kl. 04.45 +0100.484: - filter: 'Noise Suppression' (noise_suppress_filter) kl. 04.45 +0100.484: - source: 'Main Screen' (xshm_input) kl. 04.45 +0100.484: - scene 'desktop left': kl. 04.45 +0100.484: - source: 'Game Audio' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - source: 'Voice Comms' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - filter: 'Compressor' (compressor_filter) kl. 04.45 +0100.484: - filter: 'Noise Suppression' (noise_suppress_filter) kl. 04.45 +0100.484: - source: 'Left Screen' (xshm_input) kl. 04.45 +0100.484: - scene 'desktop right': kl. 04.45 +0100.484: - source: 'Game Audio' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - source: 'Voice Comms' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - filter: 'Compressor' (compressor_filter) kl. 04.45 +0100.484: - filter: 'Noise Suppression' (noise_suppress_filter) kl. 04.45 +0100.484: - source: 'Right Screen' (xshm_input) kl. 04.45 +0100.484: - scene 'desktop all': kl. 04.45 +0100.484: - source: 'Game Audio' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - source: 'Voice Comms' (pulse_output_capture) kl. 04.45 +0100.484: - filter: 'Limiter' (limiter_filter) kl. 04.45 +0100.484: - filter: 'Compressor' (compressor_filter) kl. 04.45 +0100.484: - filter: 'Noise Suppression' (noise_suppress_filter) kl. 04.45 +0100.484: - source: 'Desktop All' (group) kl. 04.45 +0100.484: - source: 'Right Screen' (xshm_input) kl. 04.45 +0100.484: - source: 'Main Screen' (xshm_input) kl. 04.45 +0100.484: - source: 'Left Screen' (xshm_input) kl. 04.45 +0100.484: ------------------------------------------------ kl. 04.45 +0100.573: --------------------------------- kl. 04.45 +0100.573: [NVENC encoder: 'recording_h264'] settings: kl. 04.45 +0100.573: rate_control: CBR kl. 04.45 +0100.573: bitrate: 50000 kl. 04.45 +0100.573: cqp: 0 kl. 04.45 +0100.573: keyint: 250 kl. 04.45 +0100.573: preset: hq kl. 04.45 +0100.573: profile: high kl. 04.45 +0100.573: width: 2560 kl. 04.45 +0100.573: height: 1440 kl. 04.45 +0100.573: 2-pass: true kl. 04.45 +0100.573: b-frames: 2 kl. 04.45 +0100.573: GPU: 0 kl. 04.45 +0100.573: kl. 04.45 +0100.747: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.748: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.748: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.748: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.748: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.748: libfdk_aac encoder created kl. 04.45 +0100.748: libfdk_aac bitrate: 160, channels: 2 kl. 04.45 +0100.750: ==== Replay Buffer Start =========================================== kl. 04.45 +0100.001: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: Mic/Aux) kl. 04.45 +0100.001:

univrsal commented 4 years ago

I don't use snap, but have you tried installing libuiohook into the same folder you put input overlay in?

univrsal commented 4 years ago

Welp just get back to me once you've tried it

thomasfinstad commented 4 years ago

I tried that, didnt have any effect for me. I entered the snap env to check for library paths

snap run --shell obs-studio
env | grep -i lib

and tried to place it there /var/lib/snapd/lib/gl no go.

Just in case I also placed it and tried with the same error in the log in all of these places:

To test with the snap you just need snapd. The config, package info, and files will not mix with your current setup by design of snap, so you should be able to have a plain setup within less than 5 min to test any thing you think might help load the file, but a setting with a path directly to the library as a fallback if all else fails would probably be the most likely to succeed if you are able to make that happen.

univrsal commented 4 years ago

Do any other plugins work, because I'm starting to have the feeling that the snap version doesn't support any

thomasfinstad commented 4 years ago

I have not tried any, but might be able to do so later today or tomorrow, but if they need library files and dont load them locally or in preconfigured places I would say no. Will update the issue within 48 hours.

thomasfinstad commented 4 years ago

Same issue with https://obsproject.com/forum/resources/spectralizer.861/ Are you able to try to load the lib from a spessified directory? If not I dont think there is much we can do at the moment.

I will also see if the obs-studio snap guys are willing to add any workaround aswell.

univrsal commented 4 years ago

Nah obs loads the plugins and just looks for the required libraries. What's the output of $ ldd input-overlay and $ readelf -d input-overlay If you put uiohook.so in the same directory as the plugin?

thomasfinstad commented 4 years ago

While in normal space:

~/snap/obs-studio/current/.config/obs-studio/plugins/input-overlay/bin/64bit$ ldd input-overlay.so
./input-overlay.so: error while loading shared libraries: libuiohook.so.0: invalid ELF header

~/snap/obs-studio/current/.config/obs-studio/plugins/input-overlay/bin/64bit$ readelf -d input-overlay.so 

Dynamic section at offset 0x25cc8 contains 31 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libobs.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libuiohook.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [/home/usr/git/obs-studio/qtc-release/libobs:]
 0x000000000000000c (INIT)               0x8000
 0x000000000000000d (FINI)               0x1e93c
 0x0000000000000019 (INIT_ARRAY)         0x26cb0
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x26cc0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x260
 0x0000000000000005 (STRTAB)             0x2750
 0x0000000000000006 (SYMTAB)             0x7d0
 0x000000000000000a (STRSZ)              13717 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x27000
 0x0000000000000002 (PLTRELSZ)           6000 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x6468
 0x0000000000000007 (RELA)               0x60a8
 0x0000000000000008 (RELASZ)             960 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x5f88
 0x000000006fffffff (VERNEEDNUM)         5
 0x000000006ffffff0 (VERSYM)             0x5ce6
 0x000000006ffffff9 (RELACOUNT)          4
 0x0000000000000000 (NULL)               0x0

While in the snap confinement:

$ ldd input-overlay.so
./input-overlay.so: error while loading shared libraries: libuiohook.so.0: invalid ELF header

$ readelf -d input-overlay.so 
bash: readelf: command not found

That is probably because the snap does not contain the binary for readelf and isnt allowed outside the snap filesystem.

univrsal commented 4 years ago

well that doesn't help much, but 0x000000000000000f (RPATH) Library rpath: [/home/usr/git/obs-studio/qtc-release/libobs:] this part is a bit strange. That is my build directory idk how that ended up in there

univrsal commented 4 years ago

I just tried installing the snap version and it crashes immediately, so I can't really try it myself One thing you can try is my plugin dvd screensaver it only depends on things obs-studio depends on, so if that one works we'll at least now that additional dependencies are the problem. Edit: I asked on the obs discord and Matt said that the plugins go somewhere in the ~/.local folder maybe you can dig around and see if there's anything related to obs

thomasfinstad commented 4 years ago

The dvd screensaver plugin works just fine, no errors, and I can add it as a source, and it works as if it was an old dvd player, pretty cool btw, I will keep it.

Maybe you could hack around it by manipulating the RPATH, https://en.wikipedia.org/wiki/Rpath I know that snaps can get access to /media folders (ref: https://forum.snapcraft.io/t/the-removable-media-interface/7910 ) so if you are willing to build and upload with external libraries loading from /mnt or /media I could test. Or just a simple instruction on how to build the plugin myself.

Not sure why the snap didnt work for you, but I would be interested in looking into it if you would give me the error (just run /snap/bin/obs-studio in the terminal)

univrsal commented 4 years ago

The error was a segfault with X11 or something, I don't think it's that easy to debug. I made some builds with Ubuntu 18.4 LTS you can try those they might crash but it should be good enough to test plugin loading.

thomasfinstad commented 4 years ago

Where can I find the binaries with the changed RPATH?

univrsal commented 4 years ago

There are none, I haven't looked into that and I'm not sure if I even want to look into that.

thomasfinstad commented 4 years ago

Can you please let me have the instructions on how to compile the plugin? I am not very well versed in software compilation, but with the required packages and instructions on how to compile your project I might be able to find out myself and give you a simple copy/paste instruction section you can add to the README.md if you want for ppl with the snap version.

univrsal commented 4 years ago

I wrote a wiki page for compiling, which should give you a general idea of what to do, if you're stuck just ask me.

thomasfinstad commented 4 years ago

I'm not gonna recompile entire OBS as that would make the whole write-up of plugin compilation just a mess.