SRS(Simple Realtime Server) is also able to covert WebRTC to RTMP, vice versa.
WebRTC to RTMP
is used for H5 publisher for live streaming. Because RTMP is disable now(at 2021.12), so the only way to publish stream by H5 is WebRTC. We also need to covert WebRTC to RTMP, which enable us to reuse the stream by other platform.
It works like this:
Chrome --WebRTC---> SRS ---RTMP--> YouTube, VLC, etc.
H.264+OPUS H.264+AAC
Note: SRS converts WebRTC/OPUS to RTMP/AAC, so each stream consume ~2% CPU.
Please follow this wiki to convert WebRTC to RTMP, which is run at localhost. If you need a web page at internet, you need to setup HTTPS, because WebRTC requires localhost or HTTPS web page to access the camera, see this wiki.
And SRS also support RTMP to WebRTC
, which is low latency live streaming. Generally, RTMP is about 3~5s latency, while RTMP to WebRTC
is about 0.8~1s
latency. Note that RTMP is not supported by H5, but HTTP-FLV
works well.
Apart of this, SRS also support HTTP-FLV, which enable H5 to play the RTMP, by mpegts.js. The latency is also lower than HLS or LLHLS.
Note: Other live streaming features are also important, because of off-topic, so please check the wiki of SRS, like DVR-MP4, DASH, Cluster, HTTP-API, etc.
It's also OK to use nginx to pull RTMP stream from SRS, or let SRS to forward RTMP to nginx, after covert WebRTC to RTMP stream by SRS.
Please don't use WebRTC to do live streaming, unless you know what you're doing, please read Why and Why NOT use WebRTC for live streaming.