How to make a Streaming Server with OBS and Ubuntu?
How to make a Streaming Server with OBS and Ubuntu?
Introduction
Open Broadcasting Studio (OBS) is an open-source streaming application that allows you to create streams and broadcast them to a self-hosted streaming server or popular platforms such as YouTube, Facebook, Twitch and DLive. This article explains how to create a streaming server with OBS to stream your content.
prerequisites
Before you begin, make sure you have the following:
Deploying a new Ubuntu server on Vultr with min
- 2 Virtual CPU (VCPU)
- 4 GB of memory (RAM)
- 80 GB of storage space
- Bandwidth 3 TB
Use SSH to access the server as a non-root user with sudo privileges.
Install a desktop environment on the server.
Install OBS on Ubuntu
OBS Studio is available in the default Ubuntu repositories.
SSH into the Ubuntu server as a non-root user.
Update and upgrade the server:
$ sudo apt update && sudo apt upgrade -y
3. Install OBS Studio and FFmpeg, which is an encoding tool.
$ sudo apt install ffmpeg obs-studio -y
Launch your YouTube Stream
Follow these steps to configure your YouTube stream:
- Log in to your YouTube Studio dashboard.
- Click the Create button in the upper right corner.
- Select Go live from the list of options.
- In the left navigation pane, click Manage.
- Click Schedule Stream.
- Enter your live stream details, including title, description, and category.
- Upload a thumbnail to display in your stream, select your target audience, and click Next.
9. Select the customization options you want and click next.
10. Set the Stream Visibility to Public on the date you want to start streaming and click Done.
In Stream Settings, set Enable Auto-Start to ON.
11. Copy the stream key to your clipboard.
OBS configuration
- Access your Ubuntu server desktop using remote desktop software such as VNC viewer or NoMachine.
- Log in as a non-root user
- Open Applications, find and launch OBS Studio.
- In the Auto-Configuration Wizard, click Yes to launch the software.
- Select the Optimize for streaming and recording is secondary options and click Next.
- Leave the video settings unchanged and click Next.
- Click the Service drop-down and select YouTube/YouTube Gaming from the list of options.
- Paste your YouTube stream key and click Next to test the best settings for your streaming.
- When finished, click Apply Settings to close the wizard.
- In the OBS Studio interface, click Settings or go to File > Settings.
- Click on Video, change the base canvas and change the output resolution to your desired settings.
Note: If your server has 2 or more VCPs, use 720p (1280 * 720) resolution. The higher the resolution and FPS value, the more processing power OBS requires.
12. Change the Common FPS value to 30 or more depending on the quality of your desired playback.
13. Go to Output and change the video bitrate to match the recommended value for your stream resolution as listed below:
| Resolution | FPS value | Recommended Bitrate Range (Kbps) |
| ———– | ———– | ————————– |
| 852 * 480 | 30 | 500 to 2000 |
| 1280 * 720 | 30 | 1500 to 4500 |
| 1280 * 720 | 60 | 2500 to 6500 |
| 1920 * 1080 | 30 | 3000 to 6500 |
| 1920 * 1080 | 60 | 4500 to 9500 |
| 3840 * 2160 | 30 | 13000 to 34000 |
| 3840 * 2160 | 60 | 20000 to 51000
14. Click Apply to save the changes.
15. Go to Advanced and find the Automatically Reconnect section.
16. Set the Retry Delay to 3 seconds or less.
17. Set the maximum retries to 1000 or more.
18. Click OK to save and exit the settings.
19. Click Studio Mode to turn on both the preview and program screens.
20. In the Sources section, click + to set your streaming audio and video source.
21. Click Transition to transition the content to the live show page.
22. Click Start Streaming to start streaming.
23. In a web browser, visit your YouTube channel and confirm that streaming is enabled.
Note: While streaming is active, you should note the OBS CPU usage rate and make sure it does not exceed 90%, otherwise your stream may drop frames resulting in multiple buffers. If the CPU usage rate is high, reduce your output resolution or upgrade the server to the next plan with more vCPUS in your Vultr account.
24. End the connection to your Ubuntu desktop and ensure that your stream remains active. You can always log in and verify that OBS is running without errors.
Streaming with self-hosted Ubuntu server
If you are using a self-hosted streaming server, follow the steps below.
Deploy and configure an Ubuntu server.
Deploy a new Windows Server 2022 instance on the VPS.
OBS Studio is more stable on Windows. Use the latest version of Windows Server to install the software and play your stream.
3. Use RDP to access the Windows server.
4. Add both servers to the same Virtual Private Cloud (VPC).
5. Test for successful communication between the servers using the network ping tool.
Installing and configuring OBS on Windows Server
- Open a web browser such as Microsoft Edge.
- Visit the official OBS Studio website.
- Download the OBS Studio installation package for Windows.
- Unzip the package and follow all the instructions in the wizard to install OBS Studio on the server.
- Run OBS Studio from the Windows Start menu.
- In the OBS auto-configuration wizard, keep Optimize for streaming and secondary recording and click Next.
- When prompted to select a streaming service, select Custom from the list of services.
- Enter the rtmp address of your VPC server in the Server field. For example rtmp://192.0.2.1/live.
- Enter the stream server key, click Next to test the connection and apply the settings.
- Go to settings.
- Adjust the resolution and bitrate to your desired settings.
- Click Advanced and set the retry delay to 3 seconds or less.
13. Find the Network section and connect OBS to your VPC IP address.
Connecting OBS to your Vultr VPC address increases stream availability due to the faster private network connection.
14. Click OK to apply the changes and start streaming to your streaming server.
15. In a web browser, visit your StarBam server URL and verify that it is active:
https://mystream.example.com
Configure Windows Server to stay active
Each Windows Server Remote Desktop connection counts as one user session. When the connection ends, the server automatically locks the account activity until you log in again. When running OBS, the server must be active for your stream to run.
Tscon is a command line tool that allows you to control remote desktop connections. As described in the following section, you can use this tool to keep your Windows server running even if your Remote Desktop connection ends.
Open Windows Command Prompt or PowerShell.
Enter the following command to display your Remote Desktop Connection ID:
> qwinsta
Your output should look like the image below:
3. Use the tscon tool to send rdp-tcp# Remote Desktop Connection ID to the console.
> tscon rdp-tcp#2 /Dest:Console
Your Remote Desktop connection should close automatically and OBS will remain active until you log back in or change server settings.
To monitor Windows Server and change console resolution. Install TightVNC on the server and connect to the VNC session when you send a remote desktop connection to the console.
4. Go to your streaming server web address and check if your live stream is running:
https://mystream.example.com
If you’re experiencing buffers in your live stream, connect to your Windows Server via VNC and check that the OBS CPU rate is below 90% or lower your resolution so that OBS uses less server resources.
Conclusion
You have successfully set up a streaming server. Depending on your streaming settings, you’ll need to monitor server bandwidth usage in your account to keep streaming up and running.