View Issue Details

IDProjectCategoryView StatusLast Update
0000719OBS-StudioXSHM Capture Source (Linux)public2019-08-24 20:03
ReporterMikeGavAssigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
PlatformOBS StudioOSLinux (Other)OS Version(any version)
Product Version 
Target VersionFixed in Version 
Summary0000719: OBS unable capture screen under Wayland session
DescriptionOBS unable capture screen under Wayland session
Additional Information$ obs
inotify_add_watch("/home/mikhail/.config/ibus/bus/b2a918734f67473a8477f0097eb1ebd3-unix-0") failed: "No space left on device"
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /usr/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/themes/Default.qss
Attempted path: /usr/share/obs/obs-studio/themes/Default.qss
Attempted path: share/obs/obs-studio/license/gplv2.txt
Attempted path: /usr/share/obs/obs-studio/license/gplv2.txt
info: Processor: 8 logical cores
info: Processor: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
info: Physical Memory: 31109MB Total
info: Kernel Version: Linux 4.8.8-300.fc25.x86_64
info: Distribution: Fedora 25
QObject::connect: invalid null parameter
info: OBS 0.16.2 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
    samples per sec: 44100
    speakers: 2
info: OpenGL version: 3.3 (Core Profile) Mesa 12.0.3

info: ---------------------------------
info: video settings reset:
    base resolution: 1920x1080
    output resolution: 1280x720
    downscale filter: Bicubic
    fps: 30/1
    format: NV12
info: ---------------------------------
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
info: No blackmagic support
info: ---------------------------------
info: Loaded Modules:
info: text-freetype2.so
info: rtmp-services.so
info: obs-x264.so
info: obs-transitions.so
info: obs-outputs.so
info: obs-filters.so
info: obs-ffmpeg.so
info: linux-v4l2.so
info: linux-pulseaudio.so
info: linux-jack.so
info: linux-decklink.so
info: linux-capture.so
info: image-source.so
info: ==== Startup complete ===============================================
error: Service '' not found
info: All scene data cleared
info: ------------------------------------------------
info: pulse-input: Server name: 'pulseaudio 9.0'
error: pulse-input: An error occurred while getting the source info!
info: pulse-input: Server name: 'pulseaudio 9.0'
error: pulse-input: An error occurred while getting the source info!
info: xshm-input: Geometry 1920x1080 @ 0,0
info: v4l2-input: Start capture from /dev/video0
info: v4l2-input: Input: 0
info: v4l2-input: Resolution: 640x480
info: v4l2-input: Pixelformat: 21UY
info: v4l2-input: Linesize: 640 Bytes
info: v4l2-input: Framerate: -nan fps
info: Switched to scene 'Scene'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Scene':
info: - source: 'Screen Capture (XSHM)' (xshm_input)
info: - source: 'Video Capture Device (V4L2)' (v4l2_input)
info: - scene 'Scene 1':
info: ------------------------------------------------
info: Update check: last known remote version is 0.4.0
info: ==== Shutting down ==================================================
info: Switched to scene '(null)'
info: v4l2-input: Stopped capture after 15 frames
info: All scene data cleared
info: ------------------------------------------------
info: Freeing OBS context data
info: == Profiler Results =============================
info: run_program_init: 303,287 ms
info: ┣OBSApp::AppInit: 0,669 ms
info: ┃ ┗OBSApp::InitLocale: 0,503 ms
info: ┗OBSApp::OBSInit: 181,457 ms
info: ┣obs_startup: 0,836 ms
info: ┗OBSBasic::OBSInit: 155,334 ms
info: ┣OBSBasic::InitBasicConfig: 0,065 ms
info: ┣OBSBasic::ResetAudio: 0,115 ms
info: ┣OBSBasic::ResetVideo: 93,746 ms
info: ┣OBSBasic::InitOBSCallbacks: 0,003 ms
info: ┣OBSBasic::InitHotkeys: 0,029 ms
info: ┣obs_load_all_modules: 9,333 ms
info: ┃ ┣obs_init_module(image-source.so): 0,002 ms
info: ┃ ┣obs_init_module(linux-capture.so): 0,239 ms
info: ┃ ┣obs_init_module(linux-decklink.so): 0,085 ms
info: ┃ ┣obs_init_module(linux-jack.so): 0,001 ms
info: ┃ ┣obs_init_module(linux-pulseaudio.so): 0 ms
info: ┃ ┣obs_init_module(linux-v4l2.so): 0,005 ms
info: ┃ ┣obs_init_module(obs-ffmpeg.so): 0,118 ms
info: ┃ ┣obs_init_module(obs-filters.so): 0,004 ms
info: ┃ ┣obs_init_module(obs-outputs.so): 0,001 ms
info: ┃ ┣obs_init_module(obs-transitions.so): 0,002 ms
info: ┃ ┣obs_init_module(obs-x264.so): 0,001 ms
info: ┃ ┣obs_init_module(rtmp-services.so): 0,273 ms
info: ┃ ┗obs_init_module(text-freetype2.so): 0,016 ms
info: ┣OBSBasic::ResetOutputs: 0,124 ms
info: ┣OBSBasic::CreateHotkeys: 0,019 ms
info: ┣OBSBasic::InitService: 0,03 ms
info: ┣OBSBasic::InitPrimitives: 0,099 ms
info: ┗OBSBasic::Load: 10,508 ms
info: obs_hotkey_thread(25 ms): min=0,044 ms, median=0,124 ms, max=13,351 ms, 99th percentile=10,399 ms, 100% below 25 ms
info: audio_thread(Audio): min=0 ms, median=0,017 ms, max=0,451 ms, 99th percentile=0,056 ms
info: obs_video_thread(33,3333 ms): min=0,742 ms, median=4,818 ms, max=96,986 ms, 99th percentile=96,986 ms, 98,8889% below 33,333 ms
info: ┣tick_sources: min=0 ms, median=2,524 ms, max=23,771 ms, 99th percentile=23,771 ms
info: ┣render_displays: min=0,003 ms, median=0,868 ms, max=8,125 ms, 99th percentile=8,125 ms
info: ┗output_frame: min=0,517 ms, median=1,212 ms, max=73,197 ms, 99th percentile=73,197 ms
info: ┣gs_context(video->graphics): min=0,188 ms, median=0,473 ms, max=73,196 ms, 99th percentile=73,196 ms
info: ┃ ┣render_video: min=0,16 ms, median=0,382 ms, max=65,84 ms, 99th percentile=65,84 ms
info: ┃ ┃ ┣render_main_texture: min=0,015 ms, median=0,136 ms, max=4,816 ms, 99th percentile=4,816 ms
info: ┃ ┃ ┣render_output_texture: min=0,002 ms, median=0,062 ms, max=61,012 ms, 99th percentile=61,012 ms
info: ┃ ┃ ┣render_convert_texture: min=0,001 ms, median=0,059 ms, max=10,183 ms, 99th percentile=10,183 ms
info: ┃ ┃ ┗stage_output_texture: min=0 ms, median=0,093 ms, max=4,822 ms, 99th percentile=4,822 ms
info: ┃ ┣download_frame: min=0 ms, median=0,006 ms, max=0,073 ms, 99th percentile=0,073 ms
info: ┃ ┗gs_flush: min=0,02 ms, median=0,057 ms, max=7,343 ms, 99th percentile=7,343 ms
info: ┗output_video_data: min=0,281 ms, median=0,746 ms, max=2,572 ms, 99th percentile=2,572 ms
info: video_thread(video): min=0 ms, median=0,001 ms, max=0,009 ms, 99th percentile=0,009 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25,108 ms, median=25,205 ms, max=38,527 ms, 69,7479% within ±2% of 25 ms (0% lower, 30,2521% higher)
info: obs_video_thread(33,3333 ms): min=13,777 ms, median=33,334 ms, max=97,001 ms, 93,2584% within ±2% of 33,333 ms (4,49438% lower, 2,24719% higher)
info: =================================================
info: Number of memory leaks: 0
TagsWayland

Relationships

has duplicate 0000609 closedJim Does OBS support Wayland? 

Activities

Jim

2016-12-01 11:19

administrator   ~0001412

Wayland is currently unsupported. Might be better to add an issue titled "Add Wayland support" instead as a feature request some time in the future.

Jim

2016-12-01 11:21

administrator   ~0001413

Additionally I don't think that the wayland devs are too interested in capture at the moment. They have bigger priorities at the moment I believe and probably have a hard time justifying it as a serious issue over other issues.

computerquip

2017-05-26 16:21

developer   ~0001970

I want to say we can fetch buffers straight from the compositor without the need to go through the Wayland protocol. Haven't had time to really give it a good look though and would be a compositor specific solution.

Fenrir

2017-11-26 02:39

administrator   ~0002816

Tossing this in here as someone came through the support chat and mentioned it as a potential (but very hacky) workaround method:

https://github.com/foss-project/green-recorder

ongy

2018-02-08 08:34

reporter   ~0003111

Hi there,

I'm working with the devs of https://github.com/swaywm/wlroots and we were discussing how to go forward the recording/screencast protocol from our end.

From my view it would be beneficial to get in contact with the devs on the client side of the protocol on this. So here I am.

As quick overview of things we are currently aware of:
There's the pipewire+portal(dbus) solution gnome is working on: https://wiki.gnome.org/Projects/Mutter/RemoteDesktop
We can abuse the screenshot api to make "videos", but this is not nice either. https://github.com/swaywm/wlroots/blob/master/protocol/screenshooter.xml


Since we aren't sold on the dbus+pipewire solution, and the other variant is honestly rather hacky, we'd like to start creating a wayland extension protocol to implement this.
Since this will be a new protocol, we have some freedom and can accomodate to your needs. It would be nice if we could cooperate on this, so we can create a protocol that's both nice to use form a client side and reasonable to implement in compositors.

kurufu

2018-02-12 23:15

reporter   ~0003128

Last edited: 2018-02-12 23:17

View 2 revisions

As OBS is preforming much the same work as the compositor, so interfaces that allow it to access the hardware buffers where possible much like the compositor would be preferred. Currently this isnt possible with the X server so everything relies on shared memory segments. However this seems a better approach then pipewire which (as I only briefly glanced at) might require copying entire video buffers back and forth. Ideally a Wayland solution would provide access to the underlying gpu buffer or memory buffer for individual windows as well as for the entire composited screen.

FWIW the ideal windows solution allows access to a window's rendering context via GDI and if given an appropriate (directx11) texture will copy on hardware. This has its issues when users are utilizing switchable graphics but provides fast window and screen capture in modern windows implementations. (perhaps a wayland solution would have provisions for switchable graphics where texture contexts might be different).

Come join #obs-dev on quakenet or the obs discord https://discord.gg/obsproject (currently more popular) to to pick the core developers brains. I don't think anyone is very experience with Wayland as we dont support it due to the lack of a capture support.

SantiagoT

2018-03-06 13:12

reporter   ~0003168

It seems xdg-desktop-portal added a new api for screen sharing. If I understood it correctly it should allow OBS to work on wayland.
See here:
http://www.jgrulich.cz/2018/03/06/screen-sharing-in-plasma-wayland-session/

kurufu

2018-03-06 14:55

reporter   ~0003169

Last edited: 2018-03-06 16:21

View 3 revisions

That blog post barely came out today and hasnt even been merged into KDE. As previously posted the gnome solution has been known and its nice to know its being merged into KDE but as mentioned by others there is more work going on in this sector of protocols so it may be best to hold off. Even more unfortunate is this particular KDE solution appears to make use of GBM buffers which IIRC are the infamous cause of contention and issue with proprietary nvidia drivers.
-- Edit --
I hope I don't come off as dismissive, if you or anyone else want to contribute a working xdg-desktop-portal plugin I'm sure it would be more than welcome. It's just hard to justify working on a wayland plugin while there is still only one fledgeling protocol supporting it (with no proven realtime recording implementations) and a small user-base. Feel free to join the discord https://discord.gg/obsproject which is the most popular forum of discussion or #obs-dev on freenode if you want to discuss ongoing or future development.

edrex

2018-12-26 04:36

reporter   ~0003754

wlroots has a protocol for this:
https://github.com/swaywm/wlroots/issues/709
https://github.com/swaywm/wlroots/blob/master/protocol/wlr-export-dmabuf-unstable-v1.xml
https://github.com/swaywm/wlroots/blob/master/examples/dmabuf-capture.c

it sounds like only missing piece is a client for this protocol that exposes the buffer via pipewire.

Then OBS should, for all three (Gnome, KDE, wlroots), be able to capture via pipewire's gstreamer sinks or via future pipewire support, yes?

kurufu

2018-12-26 16:21

reporter   ~0003755

If gstreamer implements the sink then you should be able to try right now using one of the third party gstreamer plugins. like https://github.com/fzwoch/obs-gstreamer

Thanks for the update.

edrex

2019-01-14 00:54

reporter   ~0003785

I dug in with this and learned that ffmpeg is able to capture directly from the hardware via the "kmsgrab" input device type.
Quoting https://trac.ffmpeg.org/wiki/Hardware/VAAPI#DeviceSelection:

> Compared to capturing through X as in the previous examples, this should use much less CPU (all surfaces stay on the GPU side) and can work outside X (on VTs or in Wayland), but can only capture whole planes and requires DRM master or CAP_SYS_ADMIN to run.

If OBS supported ffmpeg's kmsgrab input devices, it would provide a performant screen capture method for Wayland as well as X11 and VTs.

IDK the OBS source, but could this be implemented within the existing ffmpeg plugin, maybe in https://github.com/obsproject/obs-studio/blob/master/plugins/obs-ffmpeg/obs-ffmpeg-source.c?

I'll continue experiment and post my results here:
https://gist.github.com/edrex/82f307c1b35368952849c01a52366769

petejohanson

2019-02-08 19:28

reporter   ~0003821

FYI: I've started toying with implementing a plugin that adds a "PipeWire Screen Casting" source to OBS which you can find here: https://gitlab.com/petejohanson/obs-pipewire-screen-casting

The *basic* functionality is working, and you can find Fedora 29 + Debian Testing prebuilt binaries for anyone that wants to try it out.

Note: If you're using scaling, you'll want to see https://gitlab.gnome.org/GNOME/mutter/issues/449 and maybe apply a local mutter patch until that fix is released.

Would love any feedback there, it definitely is alpha quality at this point.

Thanks!

MikeGav

2019-02-11 17:13

reporter   ~0003830

Tested this plugin, but noted two problems:
1) High CPU usage
2) Capturing via "PipeWire Screen Casting" frequently breaks with error message "[E][module-protocol-native.c:525 on_remote_data()] protocol-native 0x7fff24039540: got connection error" for resuming capture needs restarting OBS or removing and adding again "PipeWire Screen Casting" plugin to scene.

MikeGav

2019-02-11 17:16

reporter   ~0003831

adding logs

OBS-stuck-pipewire-desktop-capture.zip (18,907 bytes)

petejohanson

2019-02-11 17:32

reporter   ~0003832

MikeGav: Thanks for the testing! The CPU usage is definitely on my list to track down and work on, as is some stability issues I've encountered as well.

I've created two issues there for tracking this:

* CPU usage - https://gitlab.com/petejohanson/obs-pipewire-screen-casting/issues/12
* Connection issues: https://gitlab.com/petejohanson/obs-pipewire-screen-casting/issues/13

In order to not pollute this tracker, please feel free to follow up there on any progress on those items.

Thanks again!

w23

2019-03-16 18:14

reporter   ~0004373

(A shameless plug) TWIMC recently I've been working on zero-copy screen capture plugin for linux that works on libdrm/KMS framebuffer level. Accidentally it also works on wayland because it operates kind of below it. I verified that it works under Sway, but haven't performed any heavy testing. It may or may not work under other wayland implementations, depending on how they handle framebuffers.
If anyone's interested, instructions on how to build and use this still work-in-progress plugin can be found at https://obsproject.com/forum/threads/experimental-zero-copy-screen-capture-on-linux.101262/
Sources are here: https://github.com/w23/obs-studio/tree/linux-libdrm-grab

edrex

2019-07-27 19:35

reporter   ~0004675

Last edited: 2019-08-24 20:03

View 2 revisions

Screen capture under wlroots-based compositors is enabled using https://hg.sr.ht/~scoopta/wlrobs (but this uses slower screencopy protocol)

Issue History

Date Modified Username Field Change
2016-11-22 19:56 MikeGav New Issue
2016-11-22 19:57 MikeGav Tag Attached: Wayland
2016-12-01 11:19 Jim Note Added: 0001412
2016-12-01 11:21 Jim Note Added: 0001413
2017-05-26 16:21 computerquip Note Added: 0001970
2017-11-26 02:39 Fenrir Note Added: 0002816
2018-02-08 08:34 ongy Note Added: 0003111
2018-02-12 23:15 kurufu Note Added: 0003128
2018-02-12 23:17 kurufu Note Edited: 0003128 View Revisions
2018-03-06 13:12 SantiagoT Note Added: 0003168
2018-03-06 14:55 kurufu Note Added: 0003169
2018-03-06 14:55 kurufu Note Edited: 0003169 View Revisions
2018-03-06 16:21 kurufu Note Edited: 0003169 View Revisions
2018-12-26 04:36 edrex Note Added: 0003754
2018-12-26 16:21 kurufu Note Added: 0003755
2019-01-14 00:54 edrex Note Added: 0003785
2019-02-08 19:28 petejohanson Note Added: 0003821
2019-02-11 17:13 MikeGav Note Added: 0003830
2019-02-11 17:16 MikeGav File Added: OBS-stuck-pipewire-desktop-capture.zip
2019-02-11 17:16 MikeGav Note Added: 0003831
2019-02-11 17:32 petejohanson Note Added: 0003832
2019-02-22 21:28 Fenrir Category XSHM Plugin => XSHM Plugin (Linux)
2019-02-22 22:43 Fenrir Category XSHM Plugin (Linux) => XSHM Capture Source (Linux)
2019-02-24 00:18 Fenrir Relationship added has duplicate 0000609
2019-02-24 05:52 Fenrir Status new => acknowledged
2019-03-16 18:14 w23 Note Added: 0004373
2019-07-27 19:35 edrex Note Added: 0004675
2019-08-24 20:03 edrex Note Edited: 0004675 View Revisions