Create an HD Gaming Capture/Streaming Setup with Linux

openbroadcastsoftware-iconTux-PodcastingI recently created a dedicated game recording/streaming setup using OBS Studio on Fedora Linux.  This lets me capture and stream real-time full 1080p video and audio from another machine playing video games.  Read on for the hardware and setup details, let’s get started.


Recording Approach

The idea here is that the only thing that occurs on the gaming PC is playing the actual game.  Since we are splitting an HDMI signal to the Linux capture PC we gain digital voice + audio.  I am using a monitor that also provides a 3.5mm-audio out (does not have speakers) that goes into my wireless headset attached to the Linux PC.  Pulse Audio drives all the setup on the Linux side.

Recording Hardware

How it All Works

obs-linux-breakdown5

Audio and Video Connection Breakdown

  • GeForce GTX 970 TI outputs HDMI to the splitter
  • Splitter out #1 goes back to the monitor I play on
  • Splitter out #2 goes into HDMI Capture Dongle
  • HDMI Capture Dongle connects to USB3 on Linux capture PC
  • Audio-out from game monitor goes to 3.5mm plug in the USB dongle of my Logitech G933 wireless headset on the Linux machine.
  • Optional USB3 Blue Yeti recording microphone plugs into capture PC as an additional audio track for commentary or other uses.

Software Installation
We’ll walk through the setup on the Linux side on Fedora.  On the gaming PC just ensure that HDMI is set as your primary audio and video device.

Install RPM Fusion Repos

dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Install ffmpeg, x264 and the PulseAudio UI

dnf install ffmpeg x264 x264-libs pavucontrol -y

Install OBS Studio RPM signing key

rpm --import http://repo.tech-3.net/Fedora/TECH3-GPG-KEY.public

Install the OBS repository

dnf -config-manager --add-repo http://repo.tech-3.net/Fedora/tech-3.repo

Install OBS Studio

dnf install obs-studio -y

Setup OBS Studio
Once everything is wired up and all of the software is installed it’s time to setup OBS.  Make sure that you also have active HDMI signals coming in as well so your gaming PC should be powered up.

First, create a scene on the bottom left part of OBS via the + button.  Name it whatever you want.

obs-scene-create

After this you’ll add a source – this is where you’ll configure the USB-HDMI capture device.  Set the resolution to the native resolution of the streaming PC.

add-obs-source

Next, you’ll need to configure the audio properties for this source, again make sure the USB-HDMI capture device is selected.

add-obs-audio-source

Next, set the proper OBS audio settings under File -> Settings – Audio.  Ensure that the USB-HDMI capture device is set as Misc/Auxiliary Audio Device.

add-obs-audio-setting

Lastly, you should set your output settings.  This will depend on your preference and testing but here are mine below.  Note that on some more demanding games I’ll actually scale down to 720p @ 30 frames per second as that gives me better results but generally I go with full 1080p @ 60 frames per second.

add-obs-setting

Click Apply and OK.  If you do not see your HDMI stream show up and audio activity you may sometimes need to untoggle / toggle “Use Buffering” under the Source settings.  Leave OBS studio up for this last part.

Setup Pulse Audio
Now you’ll want to setup Pulseaudio via the pavucontrol interface.  Below are screenshots of my setup.  First you should see OBS as a recording device from the HDMI splitter in the Recording tab.

pulseaudio-recording-tab

Next, make the following changes to the Input tab.

pulseaudio-input-tab

Lastly check the Configuration tab within PulseAudio and ensure your USB-HDMI capture device is set appropriately.

pulseaudio-config-tab

Recording and Streaming
If all is well your OBS studio should show the active HDMI output from your gaming machine, including the audio stream.  You can press start recording and you should be in business.

obs-main

record

Game Audio Options

Dedicated HDMI Monitor Audio

I ran a 3.5mm audio cable from my Dell U2414H gaming monitor audio out to the audio-in port on my Logitech G933 Wireless Headset’s USB wifi dongle, this allows me to hear game sounds since my monitor doesn’t have speakers.  I won’t cover that here as everyone’s setup is different.

Optional Software Audio Loopback

You can ride off of the HDMI audio signal by creating a loopback device in PulseAudio, though this gave me a slight latency so I preferred the direct connection.  This is reported to work well for others however so it could be my Logitech wireless USB audio setup.

sudo pactl load-module module-loopback latency_msec=1

Now you should see a loopback device appear in PulseAudio and you can set the volume as you prefer.  This would provide you game audio over the HDMI signal in software.

pa-optional-loopback

Further Setup
OBS studio lets you bring in other video capture devices like a webcam (for a small avatar type stream) as well as mix in other audio sources as tracks like commentary from another microphone, audio from VOIP chat like Mumble etc.

Part of the default functionality with OBS also allows direct streaming via the Twitch API, I will be delving into that as time allows also.  I’ll be updating this as I experiment more with this setup.

Potential Issues With 17.0.1
I’ve gotten a recording error on Fedora24 with the latest obs-studio-17.0.0-1 and I had to back down to the 0.16.6-1 versions.

[ffmpeg muxer: 'adv_file_output'] os_process_pipe_write for packet data failed
[ffmpeg muxer: 'adv_file_output'] Output of file '/srv/storage/video/2017-01-12_02-36-05.mp4' stopped

I have placed the older 0.16.6 RPMs here if anyone experiences this and wants to downgrade them until a fix is available.  I’ve filed an issue about it on the OBS forums.

Example Recordings
I am just getting started with this recording setup, and a lot more testing and field usage still needs to be done including integrating the Blue Yeti Pro Studio mic w. pop filter, but here are two example videos that I’ve recorded:

Enemy Territory: Legacy (1080p @ 60FPS)

Grand Theft Auto V – Online (720p @ 30FPS)

About Will Foster

hobo devop/sysadmin, all-around nice guy.
This entry was posted in gaming, open source and tagged , , , , , , . Bookmark the permalink.

Have a Squat, Leave a Reply ..

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s