How to use Owncast with OBS on Ubuntu 20.04

Updated on July 25, 2024
How to use Owncast with OBS on Ubuntu 20.04 header image

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

Step 1: Install Owncast

  1. Download the Owncast installation script.

     $ wget https://owncast.online/install.sh
  2. 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.

  3. Change to the Owncast directory

     $ cd owncast
  4. 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.

  5. 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.

  1. Allow connections on port 8080.

     $ sudo ufw allow 8080/tcp
  2. Allow rtmp connections using the default port 1935.

     $ sudo ufw allow 1935/tcp
  3. To configure Owncast, login to the /admin backend dashboard via port 8080.

     http://example:8080/admin 

    The default username is admin, and the password is abc123.

  4. After you log in, change the default password, which doubles as your stream key to avoid random attacks on your streaming server.

  5. To change the stream key and secure your server, click Configuration on the left pane, then select Server Setup from the list of options.

    Owncast Server Setup dashboard

    Optionally, you can also change the default ports Owncast listens on and tighten your server security.

  6. On the left pane, navigate to General under Configuration 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.

    Owncast server webpage design

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.

  1. Stop Owncast and move the current directory to /usr/share.

     $ sudo mv owncast/ /usr/share/
  2. Create a new configuration file under the /etc/systemd/system/ directory.

  3. Using your favorite editor, create the file /etc/systemd/system/owncast.service.

     $ sudo nano /etc/systemd/system/owncast.service
  4. 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
  5. Restart the systemd daemon.

     $ sudo systemctl daemon-reload
  6. 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.
  7. Start Owncast.

     $ sudo systemctl start owncast
  8. 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

  1. Open Broadcaster Software (OBS) studio on your personal computer (PC) if it's already installed, or download it from obsproject.com.

  2. Click Settings.

  3. Navigate to stream.

    OBS Settings Window

  4. Click Service and select Custom from the drop-down options.

  5. Enter your server RTMP link and stream key from your Owncast administrator dashboard.

  6. 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.