DEV Community

Cover image for How-to Broadcast a WebRTC stream to Twitch
Braden Riggs for Dolby.io

Posted on • Edited on • Originally published at bdriggs.Medium

How-to Broadcast a WebRTC stream to Twitch

Recently, while exploring syndicating Dolby.io WebRTC streams, I learned that Twitch has added support for WebRTC Ingest or WHIP as it is known in the industry.

WebRTC for streaming is an exciting choice because it can decrease stream latency compared to traditional protocols such as RTMP and HLS. When ingested, Twitch will transmux the WebRTC stream into something the platform supports (HLS), so that adds latency, slowing down the feed.

With that said, WHIP support is a great step for the community and with OBS now adding support for WebRTC, I thought I'd have to try it out.

In this guide, we'll showcase how to stream WebRTC from OBS into Twitch.

Setting up OBS for WebRTC

The core OBS project is working to add WebRTC, however, at the moment it is still an experimental build. You can try out this build by downloading the version relevant to your system here.

Once downloaded, extract the project and install it.

Streaming WebRTC from OBS to Twitch

With the project installed and launched, navigate to:
Settings -> Stream

Inside of Stream select WHIP as your service:

The WHIP settings in OBS for WebRTC streaming

To start a WebRTC stream to Twitch you need the Server path and your Stream key.

The Twitch WHIP server

The server is (currently) the same for everyone:
https://g.webrtc.live-video.net:4443/v2/offer

Note: This server currently only supports H264 and Opus encoded streams.

Getting Your Twitch Stream Key

Your Twitch Stream Key can be found on your dashboard once you've logged in, under:
settings -> stream

Your Twitch API Stream Key on the Dashboard

Copy both the Server URL and the Stream Key into the Server and Bearer Token inputs within OBS.

Twitch credentials added to OBS for WHIP streaming

Click Apply, set up OBS as usual, and click Start Stream to begin your WebRTC broadcast to Twitch.

Braden Riggs broadcasting a WebRTC stream from OBS to Twitch

Learn More

Broadcasting a WebRTC stream to Twitch is an great feature for the site as it allows people to easily syndicate their WebRTC streams to a popular platform. Because Twitch transmuxes the WebRTC stream, some delay is added, so if you're looking for an end-to-end white-label real-time streaming solution, check out Dolby.io Real-time Streaming.

A special shout out to Sean DuBois for his work on both the OBS project and on Twitch's WHIP support.

Top comments (2)

Collapse
 
josedbolivarmanexos profile image
Jose

Is there a way to do this without using OBS Studio or any audio and video recording software? That somehow by obtaining that url offer provided by Web RTC you can create the live stream on Twitch?

Collapse
 
bradenriggs profile image
Braden Riggs

Hi Jose,

Yes, it should be possible with anything that can encode WebRTC streams like your browser or other tools out there.