How to use Owncast with OBS on Ubuntu 20.04
Owncast is a free self-hosted open-source live streaming and web chat platform that lets you create live multimedia content served to your audience. The service runs with a web interface to configure a few parameters to better your streaming server and engage with the audience.
This article explains how to install Owncast on a Ubuntu 20.04 server and connect OBS to stream live content.
Prerequisites
- Deploy a new Ubuntu 20.04 cloud server.
- Log in as a standard user with sudo rights.
- Update the server.
Step 1: Install Owncast
Download the Owncast installation script.
$ wget https://owncast.online/install.sh
Run the script to install the latest version of Owncast on your server.
$ sudo bash install.sh
Output
Owncast Installer v0.0.10 Created directory [✓] Downloaded Owncast v0.0.10 for linux [✓] Downloaded ffmpeg because it was not found on your system [✓]
Owncast is now installed on your server along with FFmpeg, which handles multimedia files and streams on your server. A new directory,
owncast
, will also be created in your current working directory.Change to the Owncast directory
$ cd owncast
Start the Owncast service by running the following script:
$ sudo ./owncast
Output
INFO[2021-12-05T18:31:19Z] Owncast v0.0.10-linux-64bit (737dbf9b1a444b0b7d415da819c16d74d3d7812e) INFO[2021-12-05T18:31:19Z] Video transcoder started using x264 with 1 stream variants. INFO[2021-12-05T18:31:20Z] RTMP is accepting inbound streams on port 1935. INFO[2021-12-05T18:31:20Z] Web server is listening on IP 0.0.0.0 port 8080. INFO[2021-12-05T18:31:20Z] The web admin interface is available at /admin.
Owncast is now up and running.
Verify the installation by visiting the default page on your server IP, or domain name, at port
8080
.http://example.com:8080
Step 2: Configure Owncast
If you a running a firewall on your server, be sure to allow port 8080. or your connection will be blocked by default.
Allow connections on port 8080.
$ sudo ufw allow 8080/tcp
Allow
rtmp
connections using the default port 1935.$ sudo ufw allow 1935/tcp
To configure Owncast, login to the
/admin
backend dashboard via port 8080.http://example:8080/admin
The default username is
admin
, and the password isabc123
.After you log in, change the default password, which doubles as your stream key to avoid random attacks on your streaming server.
To change the stream key and secure your server, click
Configuration
on the left pane, then selectServer Setup
from the list of options.Optionally, you can also change the default ports Owncast listens on and tighten your server security.
On the left pane, navigate to
General
underConfiguration
to redesign your main Owncast server web page to match your preferences with a domain name, custom logo, and custom web content to describe your new streaming service.
Configure Owncast as a System service
Owncast is installed, but it doesn't start automatically if the server reboots. Follow these steps to configure Owncast as a system service.
Stop Owncast and move the current directory to
/usr/share
.$ sudo mv owncast/ /usr/share/
Create a new configuration file under the
/etc/systemd/system/
directory.Using your favorite editor, create the file
/etc/systemd/system/owncast.service
.$ sudo nano /etc/systemd/system/owncast.service
Paste the following code:
[Unit] Description=Owncast Streaming Server [Service] Type=simple WorkingDirectory=/usr/share/owncast ExecStart=/usr/share/owncast/owncast Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
Restart the systemd daemon.
$ sudo systemctl daemon-reload
Enable Owncast to run at boot time.
$ sudo systemctl enable owncast
Output
Created symlink /etc/systemd/system/multi-user.target.wants/owncast.service → /etc/systemd/system/owncast.service.
Start Owncast.
$ sudo systemctl start owncast
Check the current Owncast status.
$ sudo systemctl status owncast
Output:
● owncast.service - Owncast Streaming Server Loaded: loaded (/etc/systemd/system/owncast.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2021-12-05 20:19:33 UTC; 1min 34s ago Main PID: 1237 (owncast) Tasks: 6 (limit: 2279) Memory: 72.5M CGroup: /system.slice/owncast.service └─1237 /usr/share/owncast/owncast
Step 3: Connect OBS to Owncast
Open Broadcaster Software (OBS) studio on your personal computer (PC) if it's already installed, or download it from obsproject.com.
Click Settings.
Navigate to stream.
Click Service and select Custom from the drop-down options.
Enter your server RTMP link and stream key from your Owncast administrator dashboard.
Apply settings and click Start Streaming from your OBS dashboard to test the connection.
OBS will start broadcasting content to the server if you allow rtmp
connections through your firewall. Your stream will be displayed and available on your Owncast server domain or server IP.
You can access statistics, active users, and chats from the Owncast administrator dashboard. You can also monitor the current hardware usage by navigating to the utilities
sub-menu.
How to Embed Owncast Streams on other Websites
To embed your Owncast stream on any website you manage, add your stream's /embed/video
declarations to the target website with this snippet. Then, edit the embed code below with your server link and video dimensions.
<iframe
src="https://example.com/embed/video"
title="Owncast Livestream"
height="auto" width="auto"
referrerpolicy="origin"
scrolling="no"
allowfullscreen>
</iframe>
Conclusion
You have installed Owncast on a Ubuntu 20.04 server and configured it as a system service. If you are running multiple hosts on your server, Owncast can safely run separately on a subdomain, or any other domain name pointed to your server.
To learn more about Owncast, see the official documentation.