Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
winlinvip opened this issue Sep 6, 2022 · 2 comments
Closed

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

winlinvip opened this issue Sep 6, 2022 · 2 comments
Assignees
Labels
EnglishNative This issue is conveyed exclusively in English. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Sep 6, 2022

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
@winlinvip winlinvip self-assigned this Sep 6, 2022
@winlinvip winlinvip added the WebRTC WebRTC, RTC2RTMP or RTMP2RTC. label Sep 6, 2022
@winlinvip winlinvip added this to the 4.0 milestone Sep 6, 2022
@tyisme614
Copy link

tyisme614 commented Jan 4, 2023

request http://localhost:1985/rtc/v1/whip/ returns HTTP CODE: 502
version: SRS/5.0.128

is whip still supported on this version? @winlinvip

@winlinvip
Copy link
Member Author

winlinvip added a commit to winlinvip/srs that referenced this issue Jan 14, 2023
winlinvip added a commit to winlinvip/srs that referenced this issue Jan 15, 2023
winlinvip added a commit that referenced this issue Jan 17, 2023
@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Jul 29, 2023
winlinvip added a commit that referenced this issue Sep 21, 2023
RFC for WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip/

RFC for WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

Please note that SRS 5.0 already had WHIP support. I didn't write a
document about WHIP, because WHIP is not a RFC right now, but there are
clues in
[srs-unity](https://github.com/ossrs/srs-unity#usage-publisher). SRS
WHIP url for publisher:
`http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream`

This PR is for WHEP, the url for player is
`http://localhost:1985/rtc/v1/whep/?app=live&stream=livestream`

PS: There is a great PR for OBS to have WHIP support, see
obsproject/obs-studio#7926 and #3581

PS: WHIP for FFmpeg ossrs/ffmpeg-webrtc#1

See #3170


---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: ChenGH <chengh_math@126.com>
winlinvip added a commit that referenced this issue Sep 21, 2023
RFC for WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip/

RFC for WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

Please note that SRS 5.0 already had WHIP support. I didn't write a
document about WHIP, because WHIP is not a RFC right now, but there are
clues in
[srs-unity](https://github.com/ossrs/srs-unity#usage-publisher). SRS
WHIP url for publisher:
`http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream`

This PR is for WHEP, the url for player is
`http://localhost:1985/rtc/v1/whep/?app=live&stream=livestream`

PS: There is a great PR for OBS to have WHIP support, see
obsproject/obs-studio#7926 and #3581

PS: WHIP for FFmpeg ossrs/ffmpeg-webrtc#1

See #3170

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: ChenGH <chengh_math@126.com>
duiniuluantanqin added a commit to duiniuluantanqin/srs that referenced this issue Oct 11, 2023
RFC for WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip/

RFC for WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

Please note that SRS 5.0 already had WHIP support. I didn't write a
document about WHIP, because WHIP is not a RFC right now, but there are
clues in
[srs-unity](https://github.com/ossrs/srs-unity#usage-publisher). SRS
WHIP url for publisher:
`http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream`

This PR is for WHEP, the url for player is
`http://localhost:1985/rtc/v1/whep/?app=live&stream=livestream`

PS: There is a great PR for OBS to have WHIP support, see
obsproject/obs-studio#7926 and ossrs#3581

PS: WHIP for FFmpeg ossrs/ffmpeg-webrtc#1

See ossrs#3170

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: ChenGH <chengh_math@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EnglishNative This issue is conveyed exclusively in English. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
Development

No branches or pull requests

2 participants