Overview
Since build 5.2.1816 WebRTC stream may be published via WebRTC-HTTP ingestion protocol (WHIP). The protocol proposes a standardized SDP exchange to establish a WebRTC connection using HTTP POST request
Today, WHIP is supported by OBS Studio 30 and later, but on Windows operating system only. WHIP stream publishing is almost the same as WebRTC publishing from browser except SDP exchange.
Codecs supported
Video:
- H264
- VP8 if publisher supports it
- H265 if publisher supports it
Audio:
- Opus
- G711 (PCMA, PCMU) if publisher supports it
Operation flowchart
1. Publisher (OBS) sends HTTP POST query /rest-api/stream/publish/streamName
with SDP offer
2. Publisher receives 202 Accepted with SDP answer
3. Publisher establishes WebRTC connection and publishes a stream
4. Player establishes Websocket connection and sends playStream
command
5. Player establishes WebRTC connection and receives the stream published
Testing
1. For test we use:
- WCS server
- OBS 30 and later for Windows to publish a stream
- Player example in Chrome browser to play the stream
2. On Stream
tab in OBS settings choose WHIP
service, enter HTTP POST query URL including a stream name to publish
3. Publish the stream from OBS
4. Open Player example in Chrome browser from testing server, set the stream name to whipStream
and click Play
Authentication using Authorization: Bearer header
Since WCS build 5.2.1964 authentication using Authorization: Bearer
header is supported
In this case a publishing client (OBS) should send the header with the bearer token set with any query used when the stream is publishing via WHIP protocol. Any alphanumeric string may be used as token value, the stream name for example. The combination of the stream name and token value is checked at server side. If the token value differs from the value received with /rest-api/stream/publish
query, the server returns 409 Permission denied
Known issues
1. OBS does not support WebRTC publishing via TCP
Symptoms: a stream cannot be published from OBS when ice_tcp_transport=true
parameter is used in server settings
Solution: switch to UDP at server side
ice_tcp_transport=false