Skip to content
Welcome to the new, unified Livepeer documentation! 👋
Guides
Stream from OBS

Stream via OBS

The purpose of this guide is to allow you to get a more in-depth look at setting up a livestream using Livepeer Studio with OBS. In order to broadcast a live stream, you’ll need a stream key.

Introduction

OBS (opens in a new tab) is the way that many users stream into Livepeer because it is easy to use, open source, and offers a high degree of customization.

Prepare the environment

  • Download OBS (opens in a new tab)
  • Login or sign up at Livepeer Studio (opens in a new tab)
  • Create a stream by navigating to "Streams", clicking "Create stream", and giving the stream a name.
  • Copy the RTMP ingest URL and Stream Key in the stream detail view. You'll need these to start streaming in OBS.

Open OBS and create a source

  1. Click the + icon under sources and select Video Capture Device if you’d like to stream using a camera or webcam. If you’d like to stream a browser window, select Window Capture.
  2. Give the device a name:

OBS1 OBS2 OBS3

Input Your Stream Settings

  1. Select Stream settings.
  2. Select Custom for services.
  3. Paste the RTMP ingest URL and Stream Key provided by Livepeer Studio into the OBS “Server” and “Stream Key” fields.

OBS4

Select Output Settings and Streaming tab

  1. In the Output Mode select Advanced.
  2. Set the keyframe interval to 2-5 seconds (see the low latency section below).
  3. Save your settings.

OBS5

Stream and Check Output

After saving your settings, OBS will return to the stream console.

  1. Press start streaming (from the output you selected when inputting your stream settings above).
  2. Navigate back to your created stream in Livepeer Studio. It should now appear as "Active."

LVS4

Configuring OBS for Low Latency

Balancing Low Latency with User Experience

Achieving the right balance between low latency and stream quality is essential for providing the best possible user experience. Two settings that significantly impact your stream quality, latency, and user experience are:

  • Rate Control: This setting dictates the bitrate or "quality" of the stream. A high amount of bandwidth usually means better quality, but keep in mind that your output can never improve the quality of your stream beyond your input.
  • Keyframe Interval: Video streams consist of full frames and data relative to the full frames. This setting determines how often a full frame appears, which heavily influences latency.

Optimizing for Low Latency

Low latency is primarily determined by the keyframe interval. Having keyframes appear more frequently allows viewers to "hook onto" a point closer to the actual live point. However, full frames have a higher bit cost, so more bandwidth is needed to generate a stream of the same quality compared to a lower number of keyframes.

💡

We also require that the user turns off B-frames for lowest latency. B-frames, or bidirectional frames, are a type of video compression frame used in video encoding processes. They can improve video compression in certain situations, but are not able to be played back in our WebRTC video playback, due to frames appearing out-of-order.

Optimizing for Stream Quality and User Experience

Stream quality and user experience are mainly decided by the rate control of the stream. When optimizing for user experience, consider the stability of the video playback and the smoothness of the video. This is mostly decided by the peak bitrate of the video. A high peak bitrate can cause playback problems like buffering or skips in video playback for some viewers.

Recommended OBS Settings

The following profiles provide a good starting point for balancing low latency with stream quality and user experience. You may need to adjust the settings to suit your specific situation.

Constant Bitrate

This profile offers a good mix between quality and latency, making it suitable for most situations.

Constant Bitrate Profile
Rate Control: CBR
Bit Rate: 2000
Keyframe Interval: 2
CPU Usage Preset: Very fast
Profile: High
Tune: None
No additional x264 options

Constant Quality

This profile prioritizes maintaining a certain level of quality without being too concerned about the bitrate.

Constant Quality Profile
Rate Control: CRF
CRF: 25
Keyframe Interval: 2
CPU Usage Preset: Very fast
Profile: High
Tune: None
No additional x264 options

Since Livepeer is mostly HLS-based, a 2-second keyframe interval is generally encouraged, as HLS has a minimum latency of around 3-5 keyframe intervals. This choice would prioritize low latency.

However, if the connection is fairly poor, a 5-second keyframe interval will allow for higher quality per bit at the expense of more latency. If quality is valued over latency, this is a better choice, and you could even consider going for longer intervals. It is essential to understand the impact of each setting and adapt them to your specific requirements and priorities. The optimal stream settings may vary depending on your specific requirements.