hyperion-project / hyperion.ng

The successor to Hyperion aka Hyperion Next Generation
https://hyperion-project.org/
MIT License
2.96k stars 373 forks source link

X86_64 Linux Wayland Session - no Screen grabbing. #1096

Open Tihass1975 opened 3 years ago

Tihass1975 commented 3 years ago

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

nattyebola commented 3 years ago

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

Whisprin commented 3 years ago

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

EmilHeilbo commented 2 years ago

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 ^^'

mooreye commented 1 year ago

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.

frumble commented 1 year ago

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.

mooreye commented 1 year ago

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.

frumble commented 1 year ago

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.

Lord-Grey commented 1 year ago

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

mooreye commented 1 year ago

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

zang74 commented 1 year ago

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

mooreye commented 1 year ago

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.