hyperion.ng icon indicating copy to clipboard operation
hyperion.ng copied to clipboard

X86_64 Linux Wayland Session - no Screen grabbing.

Open Tihass1975 opened this issue 4 years ago • 11 comments

  • [x] I confirm that this is an issue rather than a question.

Bug report

When i start a Wayland Screen Session under Manjaro with Gnome Desktop, the Screen grabbing does not work, no matter which grabber I use.

Steps to reproduce

Instead of X.org use Wayland for Screen session.

What is expected?

That the function is implemented under Wayland, Wayland Support for Hyperion.

What is actually happening?

No Screen grabbing !

System

Hyperion 2.0.0-alpha.8 Manjaro 20.1.2 testet with Kernel 5.8 and 5.9 Graphic AMD Ryzen 3 3200G

Tihass1975 avatar Nov 16 '20 17:11 Tihass1975

same for me, framebuffer screen grabbing type set automatically and doesn't work is wayland supported? or in the future? or not?

nattyebola avatar Dec 14 '20 20:12 nattyebola

I gave this a try:

Using pyscreenshot I'm able to take screenshots under Wayland (Gnome 3) without any user interaction. Then I'm sending these screenshots to Hyperion using hyperion-remote -i fullscreen.png.

Of course this is very hacky and performance is horrible but it means that all necessary APIs already exist today. So I think it should be possible to implement a "hyperion-wayland" grabber using the same APIs as pyscreenshot.

An alternative route would be a Gnome 3 Hyperion extension

Whisprin avatar Mar 23 '21 19:03 Whisprin

Same issue here. Maybe it could be fixed by having PipeWire as an additional option for screen grabbing, like how Firefox, Chromium and OBS Studio handle screen capture on Wayland. I could try taking a look at implementing it, but I have no prior experience with working on C++ projects so I won't promise anything ^^'

EmilHeilbo avatar Jan 29 '22 08:01 EmilHeilbo

What's the status of this? I would be even willing to fund this (at least partially) if someone can make a HyperionNG flatpak on flathub.org with Wayland support out-of-the-box.

mooreye avatar Sep 08 '22 17:09 mooreye

What's the status of this? I would be even willing to fund this (at least partially) if someone can make a HyperionNG flatpak on flathub.org with Wayland support out-of-the-box.

A whole Flatpak build with maintenance responsibility would be a bit much, let’s start with a patch. ;) I would be willing to pay a couple bucks for this bounty too to make this project future-proof.

frumble avatar Sep 08 '22 23:09 frumble

What's the status of this? I would be even willing to fund this (at least partially) if someone can make a HyperionNG flatpak on flathub.org with Wayland support out-of-the-box.

A whole Flatpak build with maintenance responsibility would be a bit much, let’s start with a patch. ;) I would be willing to pay a couple bucks for this bounty too to make this project future-proof.

Okay, maybe flathub wouldn't accept a WWW based app, so for the time being we can use Docker. Wayland support is no longer optional, it must be done sooner or later because X is already in maintenance mode.

mooreye avatar Sep 09 '22 08:09 mooreye

Okay, maybe flathub wouldn't accept a WWW based app, so for the time being we can use Docker.

You seem to miss my point that on top of providing a Wayland patch also providing a pre-built package with maintenance responsibility is too much to ask for. Be happy if someone provides a patchset.

frumble avatar Sep 09 '22 10:09 frumble

@mooreye , @frumble I started looking into the Wayland support piece.... Curious what funding you had in mind :)

Lord-Grey avatar Sep 09 '22 19:09 Lord-Grey

@Lord-Grey I can donate, but I'm not really sure how it works and how much $$$ is needed for this.

mooreye avatar Sep 10 '22 10:09 mooreye

The HyperHDR fork of Hyperion supports pipewire screen grabbing. I'm sure it wouldn't be too hard to merge some of that code back in.

https://github.com/awawa-dev/HyperHDR

zang74 avatar Sep 12 '22 02:09 zang74

To anyone insteresed, I managed to record on Wayland this way on Fedora:

sudo dnf install v4l2loopback podman wf-recorder
sudo modprobe v4l2loopback exclusive_caps=1 card_label=VirtualVideoDevice
yes | wf-recorder -c rawvideo -m v4l2 -x yuv420p -F scale=1280:720,setsar=1:1 -t -f /dev/video0
# ^^^ 'yes' is for confirming overwrite an existing file, if you have more than 1 output it will also ask for that so you need to run 'wf-recorder' with '-o ...' flag
# -F option to specify 720p resolution, 4K would put too much load on CPU

then build docker with such Dockerfile:

FROM debian
WORKDIR /app
COPY setup.sh .
RUN ./setup.sh
WORKDIR /
USER 1000
CMD hyperiond --service -vu /app/data

where setup.sh contains:

#!/bin/bash

set -e
set -vuo pipefail

app=hyperion
repo=https://apt.hyperion-project.org/
key=https://apt.hyperion-project.org/hyperion.pub.key

export DEBIAN_FRONTEND=noninteractive
codename=$(env -i bash -c '. /etc/os-release && echo $VERSION_CODENAME')

apt-get update -qqy
apt-get dist-upgrade -o Dpkg::Options=--force-confdef,confnew -qqy
apt-get install -o Dpkg::Options=--force-confdef,confnew --no-install-recommends ca-certificates gpg wget -qqy

addgroup -q --gid 1000 $app
adduser -q --uid 1000 --gid 1000 --gecos '' --disabled-password --no-create-home $app
mkdir /app/data
chown $app: /app/data

wget -qO- $key | gpg --dearmor -o /usr/share/keyrings/$app.pub.gpg
echo "deb [signed-by=/usr/share/keyrings/$app.pub.gpg] $repo $codename main" > /etc/apt/sources.list.d/$app.list

apt-get update -qqy
apt-get install -o Dpkg::Options=--force-confdef,confnew --no-install-recommends $app -qqy

apt-get autopurge -qqy
apt-get clean

exit 0

Then run docker container with:

sudo podman run --rm --name hyperion -p 8092:8092 --device=/dev/video0:/dev/video0 --group-add=$(getent group video | cut -d : -f 3) -it hyperion

Go to https://127.0.0.1:8092/ and now as capturing USB device it detects OBS Virtual Camera and I can see live feed of my screen.

Using docker keeps your system clean and bypasses #1475.

I use sway window manager, wf-recorder requires wlroots-based compositor so not sure if this will work on GNOME.

mooreye avatar Sep 18 '22 09:09 mooreye