Skip to content

Instantly share code, notes, and snippets.

@xinyazhang
Last active June 10, 2020 01:45
Show Gist options
  • Select an option

  • Save xinyazhang/048e2be4df30dd9d7fc4febe5ee674f7 to your computer and use it in GitHub Desktop.

Select an option

Save xinyazhang/048e2be4df30dd9d7fc4febe5ee674f7 to your computer and use it in GitHub Desktop.
Zoom/Skype ScreenSharing on Fedora 32
#!/bin/bash
# Zoom's Screen Sharing is tricky because
# 1. I'd rather run it (or, any properity software) in containerized
# environment (i.e., flatpak on Fedora 32), so big NO to the official rpm
# 2. I have switched to Gnome Wayland recently and no intention to switch back
# to X11, due to a few reasons like Firefox looks better on Gnome Wayland.
# 3. RPMFusion's OBS is broken on my system for whatever reason.
# After searching on the Internet and github for a while I found and tested the following solutions.
# Reference: https://wiki.archlinux.org/index.php/Screen_capture#Wayland
# Overall scheme:
# a. Use OBS Studio+obs-xdg-portal to capture any Wayland Window
# b. Use V4L2lookback to forward videos to as camera so that Zoom/Skype can use.
# I have tried other combination listed the wiki, but most of them either
# doesn't support Gnome Wayland, or cannot pipe the video to Zoom/Skype.
# Step 1: prepare the source for Flatpak
# Following the instructions at https://github.com/flathub/com.obsproject.Studio/pull/69
git clone https://github.com/flathub/com.obsproject.Studio
git clone --branch=com.obsproject.Studio.V4L2Sink https://github.com/sirn/flathub com.obsproject.Studio.V4L2Sink
## Patch with PipeWire 0.3, due to bug: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/240
cd com.obsproject.Studio
git remote add beta https://github.com/sirn/com.obsproject.Studio.git
git fetch beta beta
#### PipeWire 0.3 patch. This commit id may be destroyed in the future,
#### but you can always search pipewire 0.3 in git log to locate the commit.
git cherry-pick 94cd07d28a2a5206e3c9520e4db5c29c9c260116
cd ..
# Step 2: Build flatpak
## Install the SDK if you hasn't, the version may change in the future
## so you can try to build and see the error about the rigth version.
flatpak install flathub org.kde.Sdk/x86_64/5.14
cd com.obsproject.Studio
flatpak-builder --force-clean build-dir com.obsproject.Studio.json --user --install
cd ..
cd com.obsproject.Studio.V4L2Sink
flatpak-builder --force-clean build-dir com.obsproject.Studio.V4L2Sink.json --user --install
cd ..
# Step 3: build v4l2lookback
git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback/
make
sudo make install
sudo modprobe v4l2loopback exclusive_caps=1 card_label=WfRecorder
v4l2-ctl --list-devices # Optional: check the loopback device is ready.
# Final: run the right OBS Studio
flatpak make-current --user com.obsproject.Studio stable # The instructions above should install to the stable branch, ...
flatpak run --user com.obsproject.Studio # ... and copied the compiled OBS Studio to the user installation.
# That's it!
# at last, make sure you disabled mirror effect in Zoom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment