mediamtx
mediamtx copied to clipboard
Add support for webRTC streaming
The only things missing in current project is webRTC which will provide less than 0.5s latency for live streaming. As you may be aware of hls or ll-hls has at least 1-2s delay for live streaming.
Regards Gaurav Choubey
Hello, the problem of WebRTC is that it requires video re-encoding from H264 to VP8 (or alternatively, the video track must already be in VP8). This can't be done without integrating a H264 decoder into the server, and this can cause legal problems, since the MPEG group requires a fee to distribute software that decodes H264.
It also requires audio re-encoding from AAC to Opus.
WebRTC theoretically also supports H264 (only the baseline profile), i did a lot of research into it during my job, but i never got it working.
Anyway, i'm leaving this feature request here, waiting for future developments.
okay thanks for explanation.
Hi,
I think, It can work with some strict settings, like disable B-frame on h264 encoder
I try rtsp-simple-server with https://github.com/deepch/RTSPtoWebRTC And it work fine.
I did some test with OBS and FFmpeg as publisher. Of course with OBS we need to had a audio transcoder to switch to Opus codec.
So I supposed it can work like this:
paths:
all:
original:
runOnPublish: ffmpeg -i rtsp://localhost:$RTSP_PORT/$RTSP_PATH -c:a opus -strict -2 -c:v copy -f rtsp rtsp://localhost:$RTSP_PORT/webrtc_$RTSP_PATH
runOnPublishRestart: yes
An example with OBS:
For exemple Wowza can convert RTMP to WebRTC: https://www.wowza.com/blog/converting-rtmp-to-webrtc-with-wowza-streaming-engine
Of course some browser can have limitations, I tried on Chrome/Chromium and Firefox, and Chrome Android and it work well.
Would it be possible to also get webRTC as a source, or does anyone have a workaround to convert webRTC into RTSP?
We use OpenVidu/Kurento to publish IP Cameras via RTSP to WebRTC https://openvidu.io/ At least that way is working. Simple RTSP Server acts as proxy for RTMP streams
For the record, I'm not sure why you say WebRTC does not support h264. It definitely does, we have been running a custom CCTV system for a couple of years, all using h264 cameras and Janus webRTC gateway
For the record, I'm not sure why you say WebRTC does not support h264.
It supports only the baseline profile, that is not used by most streams.
For regular camera it is, we have nearly 1000 cams from 10 different brands, all working through Janus and Firefox/Chrome
Hi @aler9 , do you have any development or new ideas for this feature request ? Based on your feedback above, i am thinking maybe only baseline profile support should be added for now!
Hey @aler9, any updates on this? When do you foresee some work on this topic?
WebRTC support is in beta here #1242
WebRTC support has been added in v0.21.0.
This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.