Skip to content

WebRTC: Support WHIP(WebRTC-HTTP ingestion protocol) #3170

@winlinvip

Description

@winlinvip

RFC: https://datatracker.ietf.org/doc/draft-ietf-wish-whip/

Usage

Start SRS SRS 6.0.36+ or SRS 5.0.148+, there is a WHIP and WHEP client in srs-player:

./objs/srs -c conf/rtc.conf

Then open WHIP and click Publish button.

Finally, open WHEP and click Play button.

OBS-WHIP

See #3581 and Experience Ultra-Low Latency Live Streaming with OBS WHIP!

Larix

Larix Broadcaster Apps and SDKs for capturing and streaming from mobile devices.

Please use SRS 6.0.36+ or SRS 5.0.148+.

Add a connection in Larix:

  1. Settings > Connections > New WebRTC connection
  2. URL: http://your-ip:1985/rtc/v1/whip/?app=live&stream=livestream

Click the publish button.

whip-go

whip-go is a simple WHIP client implementation in go using the WebRTC Pion libraries. It includes a WHIPClient class and a simple command line client supporrting screensharing to a WHIP ingestion endpoint.

First, clone code and build it, by Go 1.20+:

git clone https://github.com/ggarber/whip-go.git
cd whip-go
go build .

Run with:

./whip-go -v screen -vc h264 'http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream'

Note that it requires:

  • HTTP Response Status 201
  • Header with a Location, for example, /rtc/v1/whip/?app=live&stream=livestream for DELETE.

It works with SRS WHIP.

Protocol

The endpoint of SRS for WHIP:

HTTP POST http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream
Content-Type: application/sdp
Body: SDP offer.

Query string:

  • app: The app, like directory of resource. Default is live.
  • stream: The stream name, like file name. Default is livestream.

Note: Please read rtmp-url for detail.

The response of WHIP:

Content-Type: application/sdp
Body: SDP answer.

There is an example of WHIP publish:

whip-publish.pcapng.zip

The snapshot for request:

image

The snapshot for response:

image

SDP offer

v=0
o=- 8155286585472813923 1679356492 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 70:C7:51:C8:37:57:54:F0:2A:4A:A8:B5:78:59:55:8E:DC:E8:60:4E:81:ED:6F:BA:D0:C8:4B:40:FA:11:7C:CC
a=ice-lite
a=extmap-allow-mixed
a=group:BUNDLE 0 1

m=video 9 UDP/TLS/RTP/SAVPF 97 98
c=IN IP4 0.0.0.0
a=setup:actpass
a=mid:0
a=ice-ufrag:gvJoSLvvsgHgCAnj
a=ice-pwd:PoDmihiESWHpaBeyieudWrIoOEtywnqZ
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:97 H264/90000
a=fmtp:97 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtcp-fb:97 nack 
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 transport-cc 
a=rtpmap:98 H264/90000
a=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtcp-fb:98 nack 
a=rtcp-fb:98 nack pli
a=rtcp-fb:98 transport-cc 
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=ssrc:2918296482 cname:Larix
a=ssrc:2918296482 msid:Larix video
a=ssrc:2918296482 mslabel:Larix
a=ssrc:2918296482 label:video
a=msid:Larix video
a=sendonly

m=audio 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=setup:actpass
a=mid:1
a=ice-ufrag:gvJoSLvvsgHgCAnj
a=ice-pwd:PoDmihiESWHpaBeyieudWrIoOEtywnqZ
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 opus/48000/2
a=rtcp-fb:96 nack 
a=rtcp-fb:96 transport-cc 
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=ssrc:881261638 cname:Larix
a=ssrc:881261638 msid:Larix audio
a=ssrc:881261638 mslabel:Larix
a=ssrc:881261638 label:audio
a=msid:Larix audio
a=sendonly

SDP answer

v=0
o=SRS/6.0.35(Bee) 107408542208384 2 IN IP4 0.0.0.0
s=SRSPublishSession
t=0 0
a=ice-lite
a=group:BUNDLE 0 1
a=msid-semantic: WMS live/livestream

m=video 9 UDP/TLS/RTP/SAVPF 97
c=IN IP4 0.0.0.0
a=ice-ufrag:596woj5r
a=ice-pwd:3s0c79x33874iw43b1tx493y586mg69u
a=fingerprint:sha-256 AB:B1:6D:00:10:66:7B:B6:12:45:83:49:45:70:0A:99:54:03:67:89:A3:9C:83:62:9E:29:3C:2D:1A:CB:4B:3E
a=setup:passive
a=mid:0
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:97 H264/90000
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 transport-cc
a=fmtp:97 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=candidate:0 1 udp 2130706431 10.211.55.2 8000 typ host generation 0
a=candidate:1 1 udp 2130706431 10.37.129.2 8000 typ host generation 0
a=candidate:2 1 udp 2130706431 192.168.3.85 8000 typ host generation 0

m=audio 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=ice-ufrag:596woj5r
a=ice-pwd:3s0c79x33874iw43b1tx493y586mg69u
a=fingerprint:sha-256 AB:B1:6D:00:10:66:7B:B6:12:45:83:49:45:70:0A:99:54:03:67:89:A3:9C:83:62:9E:29:3C:2D:1A:CB:4B:3E
a=setup:passive
a=mid:1
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 opus/48000/2
a=rtcp-fb:96 nack
a=rtcp-fb:96 transport-cc
a=candidate:0 1 udp 2130706431 10.211.55.2 8000 typ host generation 0
a=candidate:1 1 udp 2130706431 10.37.129.2 8000 typ host generation 0
a=candidate:2 1 udp 2130706431 192.168.3.85 8000 typ host generation 0

Metadata

Metadata

Assignees

Labels

EnglishNativeThis issue is conveyed exclusively in English.WebRTCWebRTC, RTC2RTMP or RTMP2RTC.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions