Stream from OBS into a Room with WHIP
Send a studio camera, a screen capture or a produced show from OBS Studio into a live MediaSFU room. Everyone in the room sees it, and you can also broadcast it with HLS.
Before you start
- OBS Studio 30 or later (it includes WHIP output), or any WHIP-capable encoder.
- A running room and its
meetingID. The Quickstart shows how to create one. - Your API username and key, stored on your server.
1. Create an ingest session
From your server:
curl -X POST "https://mediasfu.com/v1/meetings/$MEETING_ID/external-sessions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MEDIASFU_API_USERNAME:$MEDIASFU_API_KEY" \
-d '{"displayName":"Studio camera","ingest":{"protocol":"whip","tracks":["audio","video"]}}'
The response includes the values OBS needs:
{
"success": true,
"sessionID": "ems_…",
"state": "…",
"ingest": {
"protocol": "whip",
"tracks": ["audio", "video"],
"url": "https://…",
"token": "…",
"expiresAt": "…"
}
}
Keep sessionID; you need it to check status and to end the stream. The token
is short-lived: start streaming before expiresAt.
2. Point OBS at the session
- In OBS, open Settings → Stream.
- Set Service to WHIP.
- Paste
ingest.urlinto Server. - Paste
ingest.tokeninto Bearer Token. - Click OK, then Start Streaming.
Paste the token into the Bearer Token field; don't add it to the URL.
3. Check it works
Fetch the session until its state is active and it lists your tracks:
curl "https://mediasfu.com/v1/meetings/$MEETING_ID/external-sessions/$SESSION_ID" \
-H "Authorization: Bearer $MEDIASFU_API_USERNAME:$MEDIASFU_API_KEY"
Open the room (for example its publicURL). The stream appears as a
participant named after your displayName.
4. End the stream
Stop streaming in OBS, then delete the session:
curl -X DELETE "https://mediasfu.com/v1/meetings/$MEETING_ID/external-sessions/$SESSION_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MEDIASFU_API_USERNAME:$MEDIASFU_API_KEY" \
-d '{"reason":"event_finished"}'
If an HLS broadcast or WHEP playback uses this session, delete those first.
Common problems
| Symptom | Likely cause | Fix |
|---|---|---|
| OBS reports an authorization error | Token expired or pasted into the URL | Create a new session and paste the token into Bearer Token |
| Request is declined | Streaming isn't enabled for the account, or the room has ended | Check the room is running; contact support if streaming isn't available |
Session never becomes active | OBS hasn't connected yet | Confirm OBS shows it is live, then fetch the session again |
Next: broadcast this stream with HLS, or read the streaming HTTP reference.