flathub / com.obsproject.Studio

This repository is no longer used to build OBS. Issues should be reported at https://github.com/obsproject/obs-studio
https://github.com/obsproject/obs-studio
29 stars 21 forks source link

Package obs-v4l2sink plugin #65

Open renatomefi opened 4 years ago

renatomefi commented 4 years ago

Hello,

First of all thanks for the great work here, OBS is working amazingly in my setup.

I'm a flatpak newbie, so I'm wondering how to install custom plugins? I have the feeling I shouldn't mess with the internal directories to achieve it.

The plugin I'm looking to install is https://github.com/CatxFish/obs-v4l2sink which has a dependency on a kernel module https://github.com/umlaeute/v4l2loopback#run

Any help is appreciated, thanks!

TingPing commented 4 years ago

As a user there isn't much you can do. Either we bundle it, which I have my doubts about, or we need to set up extension points for optional plugins which will require some work.

TiZ-HugLife commented 4 years ago

Can we look into extension points for plugins? I would like to display a gamepad overlay--this will make the footage we record at our locals that much better, whenever that happens--and the existing solutions for that are input-overlay, which won't even load if it can't find libuiohook and I can't compile it without an OBS development environment, and mini-padder, which I find more aesthetically appealing, but doesn't work with the obs-linuxbrowser plugin and I can't try with the regular browser plugin because it's not enabled.

Upstream already doesn't like how I've gotten obs-websockets to work (can't really blame them because they're ultimately right), and obs-websockets is mandatory for my usecase, so I would like to strongly request that we figure out The Right Way(tm) to do this.

TingPing commented 4 years ago

Extensions are absolutely welcomed we already have 3: https://github.com/flathub/com.obsproject.Studio/blob/master/com.obsproject.Studio.json#L26-L43

If that number grows maybe it can be made a bit more generic but as long as it works.

Patches welcomed for all of that.

TiZ-HugLife commented 4 years ago

I see... then I'll add figuring that out to my to-do list.

flavorjones commented 3 years ago

(edited 2020-08-20 to add git remote update)

Thanks to @sirn, V4L2Sink support is available.

Until @sirn's Flathub extension PR is officially accepted, here's how you can get this to work:

prerequisites

You'll need flatpak-builder installed. You may find this tutorial helpful to understand what this tool is and how to use it.

You'll need to be on a version of com.obsproject.Studio that has the extension point defined. This was done in commit b12add2b, and so you should see something like this when you run flatpak info:

$ flatpak info com.obsproject.Studio

OBS Studio - Live streaming and video recording software

          ID: com.obsproject.Studio
         Ref: app/com.obsproject.Studio/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 25.0.8
     License: GPL-2.0
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 45.2 MB
     Runtime: org.kde.Platform/x86_64/5.14
         Sdk: org.kde.Sdk/x86_64/5.14

      Commit: efbd5d2fc438ae7dd6602fca6beeba1e849cd920134d5c1339cbf040f48ab958
      Parent: ee065632ecbac3e8a419f699424069e0b0842c10d3a5bd9972862a9b7b48c78d
     Subject: Add v4l2sink plugin entrypoint (b12add2b)
        Date: 2020-05-30 17:19:40 +0000

steps

First, clone the proposed flathub extension for V4L2Sink:

# run these commands
git clone https://github.com/flathub/flathub
cd flathub
git remote add sirn https://github.com/sirn/flathub
git remote update
git checkout -b com.obsproject.Studio.V4L2Sink sirn/com.obsproject.Studio.V4L2Sink

You should now see three files in your directory:

Install the SDK that flatpak-builder will need to use:

# run this command
flatpak install flathub org.kde.Sdk//5.14

And now build and install the V4L2Sink extension:

flatpak-builder build --force-clean com.obsproject.Studio.V4L2Sink.json --install --user

success

When OBS Studio starts, it will look for an extension that provides the V4L2Sink module, and if it's present will load it.

If everything has worked, you should now see "V4l2sink" in the "Tools" menu.

If something's wrong, take a look at the logs ("Help" → "Log Files" → "View Current Log") and see if there are any error messages about "v4l2sink".

In the successful case, my log looked like (in part):

09:20:32 AM.816: ---------------------------------
09:20:32 AM.816:   Loaded Modules:
09:20:32 AM.816:     text-freetype2.so
09:20:32 AM.816:     rtmp-services.so
09:20:32 AM.816:     obs-xdg-portal.so
09:20:32 AM.816:     obs-x264.so
09:20:32 AM.816:     obs-v4l2sink.so
09:20:32 AM.816:     obs-transitions.so
09:20:32 AM.816:     obs-outputs.so
09:20:32 AM.816:     obs-libfdk.so
09:20:32 AM.816:     obs-filters.so
09:20:32 AM.816:     obs-ffmpeg.so
09:20:32 AM.816:     linux-v4l2.so
09:20:32 AM.816:     linux-pulseaudio.so
09:20:32 AM.816:     linux-decklink.so
09:20:32 AM.816:     linux-capture.so
09:20:32 AM.816:     image-source.so
09:20:32 AM.816:     frontend-tools.so
09:20:32 AM.816:     decklink-ouput-ui.so
09:20:32 AM.816: ---------------------------------
roblem commented 3 years ago

The above steps failed for me because sirn/com.obsproject.Studio.V4L2Sink has been deleted.

Instead, I did it like this (since with recent builds the plugin mechanism already is enabled, so we only need the plugin):

  1. git clone --branch=com.obsproject.Studio.V4L2Sink https://github.com/sirn/flathub com.obsproject.Studio.V4L2Sink
  2. cd com.obsproject.Studio.V4L2Sink/
  3. flatpak-builder --force-clean build-dir com.obsproject.Studio.V4L2Sink.json --user --install

When I restart obs-studio, I see v4lsink listed in tools.

flavorjones commented 3 years ago

@roblem I've updated the instructions in my comment above to include a missing git remote update. Sorry about that, and thanks for pointing out the problem.

sirn commented 3 years ago

Sorry for lack of updates. I'll try to get the plugin submitted to Flathub this weekend 🙇

roblem commented 3 years ago

This plugin is working great and what I am reporting here is a minor annoyance. Let me know if I should refile somewhere else.

Starting and using the plugin has been rock solid over numerous long zoom meetings.

However, when I click stop at this dialog (or exit obs without stopping it): dialog obs crashes. This occurs on Fedora 32 with selinux set to "permissive" or "enforcing". Also, I have tried starting obs from the command line using flatpak run com.obsproject.Studio to see if any clues are dumped in terminal (but everything reported here also occurs via the desktop launcher). Here is what I see (and this is mirrored in the obs logs):

<<a bunch of stuff omitted>>
info: Output 'V4l2sink': stopping
info: Output 'V4l2sink': Total frames output: 133
info: Output 'V4l2sink': Total drawn frames: 134

In the journalctl log, I see this (this is in selinux permissive mode):

Aug 21 11:19:38 pinnacle systemd[181698]: Started flatpak-com.obsproject.Studio-259644.scope.
Aug 21 11:19:53 pinnacle kernel: uvcvideo: Failed to resubmit video URB (-1).
Aug 21 11:19:53 pinnacle audit[259655]: ANOM_ABEND auid=1001 uid=1001 gid=1002 ses=12 subj=unconfined_u:unconfined_r:unconfine>
Aug 21 11:19:53 pinnacle kernel: obs[259655]: segfault at ffffffffffffffff ip 00007f69416cf8d0 sp 00007ffc4aaf7a98 error 5 in >
Aug 21 11:19:53 pinnacle kernel: Code: 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 83 ec 18 48 8b 05 29 96 13 00 48 8b 00 48 >
Aug 21 11:19:53 pinnacle audit: BPF prog-id=333 op=LOAD
Aug 21 11:19:53 pinnacle audit: BPF prog-id=334 op=LOAD
Aug 21 11:19:53 pinnacle audit: BPF prog-id=335 op=LOAD
Aug 21 11:19:53 pinnacle systemd[1]: Started Process Core Dump (PID 259695/UID 0).
Aug 21 11:19:53 pinnacle audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 m>
Aug 21 11:19:54 pinnacle systemd[181698]: flatpak-com.obsproject.Studio-259644.scope: Succeeded.
Aug 21 11:19:54 pinnacle systemd[181698]: flatpak-com.obsproject.Studio-259644.scope: Consumed 11.883s CPU time.
Aug 21 11:19:54 pinnacle systemd-coredump[259696]: Process 259655 (obs) of user 1001 dumped core.

                                                   Stack trace of thread 2:
                                                   #0  0x00007f69416cf8d0 n/a (/usr/lib/x86_64-linux-gnu/libc-2.30.so + 0x898d>
Aug 21 11:19:54 pinnacle systemd[1]: systemd-coredump@24-259695-0.service: Succeeded.
Aug 21 11:19:54 pinnacle audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 ms>
Aug 21 11:19:54 pinnacle audit: BPF prog-id=335 op=UNLOAD
Aug 21 11:19:54 pinnacle audit: BPF prog-id=334 op=UNLOAD
Aug 21 11:19:54 pinnacle audit: BPF prog-id=333 op=UNLOAD
Aug 21 11:19:55 pinnacle abrtd[1021]: Size of '/var/spool/abrt' >= 5000 MB (MaxCrashReportsSize), deleting old directory 'ccpp>
Aug 21 11:19:55 pinnacle abrt-server[259714]: Unsupported container technology
Aug 21 11:19:55 pinnacle abrt-server[259714]: Lock file '.lock' was locked by process 259717, but it crashed?
Aug 21 11:19:57 pinnacle abrt-server[259714]: Error: No segments found in coredump './coredump'
Aug 21 11:19:57 pinnacle abrt-server[259714]: Can't open file 'core_backtrace' for reading: No such file or directory
Aug 21 11:19:58 pinnacle abrt-notification[259761]: Process 259655 (obs) crashed in ??()
flavorjones commented 3 years ago

@roblem I think you're seeing https://github.com/CatxFish/obs-v4l2sink/issues/10 please subscribe to that issue and follow along there.

rombert commented 3 years ago

Would it be possible to package the fix from https://github.com/CatxFish/obs-v4l2sink/pull/21 so that flatpak users get the proper behaviour? Based on the discussions in that GitHub repo it seems there are not many changes to get it properly merged. Thanks!

roblem commented 3 years ago

Update on the instructions. Recent changes somewhere no longer provides the json but rather a yaml file. I have these files in the flathub folder

com.obsproject.Studio.V4L2Sink.yaml
com.obsproject.Studio.V4L2Sink.metainfo.xml
flathub.json

rather than

com.obsproject.Studio.V4L2Sink.json
com.obsproject.Studio.V4L2Sink.metainfo.xml
flathub.json

So I ran this build command with success:

flatpak-builder build --force-clean com.obsproject.Studio.V4L2Sink.yaml --install --user
vchernin commented 2 years ago

I think since #94 is fixed this issue is solved now.