I’ve had a number of requests to get a guide up on how to livestream from Linux to Twitch. It’s damn easy, so here’s how to do it.
Note: While this is aimed at Twitch, the process is exactly the same for any streaming service OBS Studio supports (apart from grabbing the streaming key of course, that's different for each service). OBS Studio supports Youtube, Twitch, hitbox, beam.pro and more out of the box.
First, download OBS Studio which on Arch is available in the repository, but for Ubuntu head to this page and follow the instructions for adding the repository and installing it.
Now, make sure you’re signed up on Twitch. Then head to the "Account Settings" available when clicking your avatar, and select the "Channel and Videos" tab with the first field being the key you need. See these images below:
Once there, hit the Show button and copy the entire thing. The Stream Key is yours and yours alone, do not share it. It's essentially the password to livestream to your Twitch channel. Make sure there’s no hidden space at the end of what you copy, as that will register as a character in OBS Studio and then your stream won't work. It's a small thing, but it has happened to numerous people.
Once you open OBS Studio, hit the "Settings" button on the right and then select the "Stream" tab on the left:
Paste in the Stream Key I told you to copy earlier and pick a Server close to you.
Next, you need to actually sort out the video settings for what you’re going to be sending to the Twitch servers. Go to the "Video" tab on the left. You want to make sure you resolution is correctly set. Streaming at 1080p (1920x1080) can be quite demanding on your hardware, so unless you're streaming simple games or your have a powerful computer (or a capture card) you might want to start with 720p:
The “Output (Scaled) Resolution” is what you will be sending to your viewers. Also, you likely want it set to “30” for FPS, as having it higher is also more demanding on your system.
Next up, you need to sort out the Bitrate settings for the the video you send to the Twitch servers. This depends on your resolution and your target FPS. Here's a quick list (from here):
- 720p 30FPS - 3000 kbps Bitrate
- 720p 60FPS - 4500 kbps Bitrate
- 1080p 60FPS - 6000 kbps Bitrate
The higher the number, the higher the quality of your video will be, but it will depend on you having a good internet upload speed. A good rule to follow for those on low-speed connections, is to set the Bitrate to about half of your maximum upload speed. So if you get 5mb/s download, a 2500 Bitrate should do. Don't go higher than 6000, as that's Twitch's current limit for normal streams.
Now that's all the work behind closed doors sorted, you need to actually show something to your audience. The best option in my opinion, is not to livestream your whole screen. Instead, I use the Window Capture option, then everything else can stay private and messages from applications you left open won't end up in the middle of the screen for all to see. Doing this is also simple! On the main OBS Studio screen, click the little + under the "Sources" panel to add it:
Give it a name and then you will be greeted with this:
Just pick which application or game you want from the "Window" dropdown box and then that will be shown to your viewers.
Once that's done, close the Settings panel and hit "Start Streaming" and that's all there is to it.
Happy streaming Linux gamers!
One thing I think a lot of new Linux gaming users would like is information about setting up graphics drivers on Linux. What to do if your display manager stops working, how to install a proprietary driver (and get rid of it again), all those tricky things.
I can't even play games :'(
Depending on the game you're playing, you may want to use CPU or GPU encoding... whichever has more processing power to spare.
github source:
https://github.com/bazukas/obs-qtwebkit
arch AUR:
pacaur -S obs-qtwebkit-git
then open obs, right click sources>add browser source and paste your url
side note #2: if you have an nvidia 600 series or higher gpu with the proprietary drivers, you can use nvenc to encode your stream in obs instead of x264, which is particularly useful if you don't have a strong cpu. nvenc uses dedicated encoding hardware on nvidia maxwell gpus (and higher) which does not take away from gpu performance. this is also what nvidia uses for shadowplay. amd has something similar as well which can also be used in OBS, but i don't remember the name of it.
Last edited by GloriousEggroll on 16 March 2017 at 4:57 pm UTC
Is it only a gaming-community streamers, or can I stream my sketch done via Krita with the Linux-Streamers flag ? ?All Linux Streamers welcome :)
See more from me