Skip to content

Instantly share code, notes, and snippets.

@rondhi
Last active November 11, 2024 14:10
Show Gist options
  • Save rondhi/f9163e7649aa734b5421a8f58bd6c49e to your computer and use it in GitHub Desktop.
Save rondhi/f9163e7649aa734b5421a8f58bd6c49e to your computer and use it in GitHub Desktop.
How to stream games from OBS directly from Steam Deck's Gaming Mode

How to stream games from OBS directly from Steam Deck's Gaming Mode (as of 2023-02-26)

DISCLAIMER: As with any guide, please make sure to read through and understand everything before following the steps in this guide. I'm not responsible for you breaking anything on your own device. This guide assumes you have a little background with the linux command line as well as the text editor nano. If not, please educate yourself


Description: It's possible to stream Vulkan and OpenGL games from Gaming Mode on your Steam Deck. This guide is heavily based on robertkirkman's guide, which is linked multiple times throughout this guide. Much thanks to them


Basic summary

  1. Install OBS Studio and OBS VkCapture Plugin via flatpak
  2. Add OBS Studio to Steam
  3. Install rwfus Read-Write OverlayFS for Steam Deck
  4. Add the chaotic-aur repository
  5. Install obs-vkcapture-git via chaotic-aur
  6. Add Game Capture source to OBS
  7. Edit game launch options

In Steam Deck Desktop Mode

1. Install OBS Studio and OBS VkCapture Plugin via flatpak

  • OBS Studio
  • OBS VkCapture Plugin
  • Note: You may notice that the Discover Store also has an OBS VkCapture tools but I haven't been able to get a game capture going that way. I was only able to get a game capture by installing obs-vkcapture via command line/AUR.

According to OBS VkCapture Github

If you use Flatpak OBS, you need to install Flatpak OBS plugin. For capturing games outside Flatpak runtime, you need native build regardless of if you are using Flatpak OBS or not.

OBS-flatpak-install

2. Add OBS Studio to Steam (Source)

a. From the start menu, find OBS Studio, right-click, and add OBS Studio to Steam. I also recommend adding it to your favorites in Steam.

b. In order to get OBS Studio to launch in Gaming Mode: In Steam, edit the launch options for OBS Studio:

LD_PRELOAD= OBS_USE_EGL=1 QT_QPA_PLATFORM=xcb %command% run --branch=stable --arch=x86_64 --command=obs com.obsproject.Studio

OBS-launch-options

3. Install rwfus Read-Write OverlayFS for Steam Deck Source

These instructions may not be up-to-date. Visit the rwfus github page for up-to-date installation instructions.

The advantage of using an OverlayFS is that any packages you install via pacman or AUR will persist even after a SteamOS update. We want to use the dev branch of rwfus because it's been updated for SteamOS 3.4.

Open up the the terminal app (by default, it's Konsole on SteamOS). Keyboard shortcut is usually CTRL+ALT+T. Enter the following commands one by one.

cd ~
wget -O rwfus.zip https://github.com/ValShaped/rwfus/releases/download/v0.4.1-beta1/rwfus-0.4.1-beta1.zip && unzip rwfus.zip -d rwfus
cd rwfus
chmod +x rwfus

These commands download the latest rwfus release. Side note: if you don't have a sudo password set up, use passwd, then enter the rest of the commands to install rwfus.

sudo ./rwfus --install
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -Sy

4. Add the chaotic-aur repository

First, you should educate yourself on what the Arch User Respository (AUR) is. It's a community driven repository which is meant to help users build packages from source. It's up to the user to verify the contents of the package.

The Chaotic AUR is a repository of pre-built packages. Please see this on the safety of using Chaotic AUR and AUR in general. Is chaotic-aur safe to use?

Add the chaotic repository to your list of repository mirrors. Find up-to-date instructions here

sudo pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com
sudo pacman-key --lsign-key FBA220DFC880C036
sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'

Now to add the chaotic-aur mirror to the repository list. We do this by appending some text to the end of the /etc/pacman.conf file. You can do this by editing the file with nano or vi with root access.

sudo nano /etc/pacman.conf
[chaotic-aur]
Include = /etc/pacman.d/chaotic-mirrorlist

Finally, refresh the repository list

sudo pacman -Sy

5. Install obs-vkcapture-git via chaotic-aur

sudo pacman -S obs-studio chaotic-aur/obs-vkcapture-git

After confirming, you should have obs-vkcapture installed. You can make sure you have it installed by typing

obs-vkcapture

And you should see something like

WARNING: Please use obs-gamecapture instead.
ERROR: No program supplied

Usage: obs-gamecapture <program>

7. Add Game Capture source to OBS

  • You can add a Game Capture source within OBS. Default settings are fine.
  • I suggest right-clicking the source and selecting Transform > Fit to Screen so it fits to the canvas no matter what resolution you're playing at.

add-game-capture-source

8. Edit game launch options

Once you have obs-vkcapture installed, edit a game's launch options with the line below. The Game Capture source will capture whatever game you're running with these launch options:

obs-gamecapture %command%

edit-game-launch-options

In Steam Deck Gaming Mode

  1. Press the Steam button. Go to Library. Press R1 until you get to NON-STEAM. Launch OBS Studio (you can also find it in your Favorites if you favorited it earlier in the guide)
  2. Press the Steam button. Go to Library. Launch your desired game
  3. As long as the game you choose supports OpenGL or Vulkan, OBS Studio should be able to capture that game.
  4. Have fun streaming on the go!

OBS-gaming-mode

Note: Even if the game is OpenGL or Vulkan, there's no guarantee that OBS will be able to capture the game. Your mileage may vary.

Other tips

  • If you don't want to pull from chaotic AUR all the time, you can remove the repository from pacman.conf by commenting out the lines with # and then refresh the repository list:
#[chaotic-aur]
#Include = /etc/pacman.d/chaotic-mirrorlist
  • You can use Droidcam OBS plugin to use your smartphone as a webcam source in OBS. More info here
  • Another possible smartphone-as-a-camera method is VDO Ninja
  • If you want to isolate game audio, you can use Helvum (found in Discover Store) and a Jack audio source within OBS to isolate the game sounds
  • In case you want to stream over to Discord or something, you can enable Virtual Camera in OBS

Install OBS VirtualCam (Source)

sudo pacman -S linux-neptune-headers libappindicator-gtk3
sudo pacman -S v4l2loopback-dkms v4l2loopback-utils

Support

If you need any support, feel free to post open a support post in the help channel on the Steam Deck discord and tag @rondhi#1234

@X-m7
Copy link

X-m7 commented Jul 13, 2024

OBS recently updated to version 30.2, which seems to have broken both the GStreamer and Vulkan/game capture plugins completely at the moment, so you'll need to install an older version instead, I think one of the previous comments has a command for that.

@LTJ233
Copy link

LTJ233 commented Jul 13, 2024

OBS recently updated to version 30.2, which seems to have broken both the GStreamer and Vulkan/game capture plugins completely at the moment, so you'll need to install an older version instead, I think one of the previous comments has a command for that.

@X-m7 Thx bro! It works pretty good after degrading.It seems that 30.0.2 should be the most compatible solution for now.

@SuDunPo
Copy link

SuDunPo commented Jul 14, 2024

As I wrote above I'm using the version 30.1.2 because in version 30.0.2 we can't choose VAAPI H.264 on VanGogh [AMD Custom GPU 0405] as Video Encoder. If you like me use Lutris for running non-steam games & want to stream them using "Game Capture" methode, move "obs-gamecapture.sh" script from /home/deck/.local/bin to your's wine-prefixes directory, in my case it's /home/deck/.wine .
And then add line /home/deck/.wine/obs-gamecapture %command% in Launch parameters of your non-steam game in Steam Library.

I didn't change anything in the obs-gamecapture script itself. Works good.

Update: I don't know why, but it's not work with lutris-flatpak. =/

@darylducharme
Copy link

Does anyone know if 30.2.0 has fixed this so we can update and still use the Gstreamer method?

@CoderMonkey1956
Copy link

CoderMonkey1956 commented Jul 17, 2024

Does anyone know if 30.2.0 has fixed this so we can update and still use the Gstreamer method?

Unfortunately, for now you have to run this command to downgrade obs: sudo flatpak update --commit=e641d66f8f509ff18c1e82bfd6e32e0e0021e56cb01d1471b00f56d82ea8bfa1 com.obsproject.Studio (Thanks @Cyphs)

@LTJ233
Copy link

LTJ233 commented Jul 17, 2024

I would like to ask why try to use the latest version since 30.0.2 is available? Does it have better performance?🤔

@rondhi
Copy link
Author

rondhi commented Aug 3, 2024

obs-gstreamer was recently updated. I did try using it on OBS 30.2, but it's still unable to get an image from gamescope. So my recommendation is to still stay on OBS Studio 30.0.2 for capturing games in Game Mode with obs-gstreamer. I haven't done any research on why it stopped working on OBS 30.1+, and I'm not knowledgable enough to figure out why. I hope others will be able to figure out what's going on.

@Urfoex
Copy link

Urfoex commented Oct 24, 2024

OBS 30.2.3
SteamOS 3.6.19 Stable
It seems to work again.

Step 3 says rwfus
They recommend nix, so I tried
$ sh <(curl -L https://nixos.org/nix/install) --no-daemon

$ sudo chown -R deck /nix
$ rm ~/.local/state/nix/
$ sh <(curl -L https://nixos.org/nix/install) --no-daemon
$ source /home/deck/.nix-profile/etc/profile.d/nix.sh 

And then inside the Steam Game Properties:

nix-shell -p obs-studio-plugins.obs-vkcapture --run "obs-gamecapture %command%"

This didn't want to work inside steam.
I found https://search.nixos.org/packages?channel=24.05&show=obs-studio-plugins.obs-vkcapture&from=0&size=50&sort=relevance&type=packages&query=vkcapture

nix-env -iA nixos.obs-studio-plugins.obs-vkcapture

And then you can use obs-gamecapture as usual. But games still didn't work for me.

obs-gamecapture %command%

With a local version of https://anuke.itch.io/mindustry it worked.

So I used rwfus and it worked again.

@rondhi
Copy link
Author

rondhi commented Nov 10, 2024

OBS 30.2.3
SteamOS 3.6.19 Stable
It seems to work again.

I'd also like to point out that Flatpak OBS 30.2.3 on SteamOS 3.6.20 is also working again with the gstreamer (flatpak) method, which is still my recommended method, explained here: https://gist.github.com/rondhi/f9163e7649aa734b5421a8f58bd6c49e?permalink_comment_id=4653330#gistcomment-4653330

@SuDunPo
Copy link

SuDunPo commented Nov 11, 2024

Congratulations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment