OBS Studio - Stream From Linux Distribution
OBS Studio is the all-in-one tool for streaming your video in real-time. It is free to use, open-source, and supports all major platforms, including Linux. In this article, I will walk you through a tour of OBS Studio. You will learn how easy it is to stream your video from your Linux computer.
How to Install OBS Studio in Linux distributions
OBS Studio is already available in almost all Debian based Linux distributions’ official repositories, but it’s a little older version. To install the latest version, please add the following repository in your distro.
For Ubuntu and derivatives –
sudo apt install ffmpeg
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt install obs-studio
For Arch Linux and derivatives distros –
sudo pacman -S obs-studio
For Fedora and derivatives distros –
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install obs-studio
For NVIDIA Hardware-accelerated encoding, please install CUDA –
sudo dnf install xorg-x11-drv-nvidia-cuda
Install OBS Studio Snap app
If your Linux distribution supports snapd, you can install the OBS Studio snap app.
sudo snap install obs-studio
For more information on how to install snapd on your Linux distribution, please read this guide.
OBS Studio Startup
For the first time when you start OBS Studio, it runs a configuration wizard for a quick setup. The first step asks the purpose of using OBS Studio to better optimize the software for you.
For optimizing your streaming, select “Optimize for Streaming, recording is secondary”. After this, click next.
In the next step, select the video resolution settings and FPS you want to stream. By default, the software selects the resolution of the current monitor. For FPS, leave it as it is. Click next.
In the next step, you can select the streaming service. OBS supports a wide range of streaming services. It can easily set up the service with the software using a streaming key.
For example, I want to stream to Twitch, so I select Twitch and click “Get Stream Key”. It opens up the twitch website and asks for the user credentials. Enter the credentials to log in and get your Stream Key.
Once you have the Stream key, you can copy it and paste it into the OBS Studio.
And that’s it. I am almost ready to stream my video on Twitch. Review the settings for the last time and hit “Apply Settings”.
OBS Studio Interface
By default, OBS loads with 6 sections. First is the preview section, where you can see how people would see your screen.
The second section is where you can create scenes. Each scene can have different windows on your computer.
The third section is the Sources section. After creating a scene, you can add video input(s) to it, such as a webcam, Game window, or any other input you want.
Forth section is the Audio Mixer for managing audio devices. If you want to activate sound from your Mic, you can mute other devices except for the Mic and vice-versa.
The fifth section is for scene transitions. If you have added multiple scenes, you can switch between scenes when you’re live. To make the scene switching smoother, you can add transition effect and duration.
Last but not least is the controls section. You can start streaming, start screen recording, switch to Studio Mode, and manage settings.
Add stats section
Stats section shows the current system statistics such as CPU usage, Frame rate per second, disk space available, memory usage, and it even shows the frames missed/skipped due to rendering/encoding lag.
To add the Stats section, right-click on the section’s title and check Stats. It will activate the Stats window that you can drag-n-drop anywhere on the OBS window.
How to use OBS Studio
Create scenes
To start streaming any particular window, you can add that window in the sources section and start streaming. Later on, while you’re streaming, you’ll have trouble switching the window in case you want to broadcast any other application to your viewers.
For that, create a specific scene to manage how you would want that scene to appear to viewers.
For example, in one scene, I can stream my terminal, the second can be my file manager, and in case I want to show my web browser to viewers, the third scene can be a Web browser.
To create a scene, right-click the scene section, click ‘Add’.
Now enter the scene name. And click Ok.
Add sources
After creating a scene, add at least one source to it. You can right-click the source section and hover over Add. It will show all the sources you can add to the scene.
You can add images, image slideshow, Any media source, Scene, Capture the entire screen, Text, VLC Video source, any video capturing device(Webcam), etc.
Add webcam overlay
You must have seen streamers showing a webcam overlay on the video. It’s straightforward to do that. To create the webcam overlay, create a separate scene. I’ve named it Webcam. You can name it whatever you like.
Add overlay window as an image. You can download webcam overlay for OBS from the internet. There are a ton of free webcam overlays available. The one I am using in this article can be downloaded from here.
Right-click the overlay image, click Resize output (source size). It’ll expand the image to its full size.
Now add a video capture device aka—webcam, to the scene.
Next up, select the webcam, video format, resolution, and frame rate. You can also adjust brightness, contrast, and saturation. Once done, click Ok to add a webcam to the scene.
By default, the latest source appears on top of other sources. You can drag it down in the Sources section to pull it back.
Once you have adjusted the webcam inside the overlay window, it’s good to go. You can now add this Scene to any other scene as a source.
For example, I want to show webcam overlay on my web browser scene to click the web browser scene and add a new source, ‘Scene’. Now select the Webcam scene.
Audio devices
In OBS Studio, managing audio devices is straightforward. All the available devices are listed in Audio Mixer. You can add, delete, mute, and unmute any device you want. For example, if you want the viewers to listen to your desktop audio, you can mute the Mic device and unmute Desktop Audio.
Scene transitions
When you’re live and switching between the scenes, you can add a transition effect and duration. There are only two transitions available, Cut and Fade. Set fade transition and duration 300ms for a quick and easy fade-in effect.
Start streaming
And that’s it. You are now ready to stream. Just click “Start Streaming” and the streaming will start.
You can further explore OBS Settings, and it has a ton of options. The following table will help you by providing accurate values based on the quality of the video you want to stream.
Local Transcoding Mode Settings
Quality | Resolution | Video Bitrate | Audio Bitrate | Frames Per Second | Video Codec | h.264 Profile | Audio Codec |
Low | 480×270 | 400kbps | 64kbps | 25 / 30 | h.264 | Baseline | AAC-LC |
Medium | 640×360 | 800 – 1200 kbps | 96kbps | 25 / 30 | h.264 | Main | AAC-LC |
High | 960×540 / 854×480 | 1200 – 1500 kbps | 96kbps | 25 / 30 | h.264 | Main | AAC-LC |
HD 720 | 1280×720 | 1,500 – 4,000 kbps | 128kbps | 25 / 30 | h.264 | Main | AAC-LC |
HD 1080 | 1920×1080 | 4,000-8,000 kbps | 192kbps | 25 / 30 | h.264 | Main or High | AAC-LC |
4K | 3840×2160 | 8,000-14,000 kbps | 192kbps | 25 / 30 | h.264 | High | AAC-LC |