I'm trying to use RTSPtoWeb (GitHub - deepch/RTSPtoWeb: RTSP Stream to WebBrowser) to use my RTSP stream from my IP cam as WebRTC in OctoPrint but with no luck... WebRTC stream from RTSPtoWeb is working - when I access it from demo page with Chrome, but when I use webrtc://demo:demo@octopi.groch.lan:8083/stream/Groch-CAM2/channel/0/webrtc URL in OctoPrint and test it, I can see only browser WebRTC player playing nothing... I can see error in RTSPtoWeb log when trying to play WebRTC through OctoPrint:
[GIN] 2022/05/26 - 08:54:16 | 204 | 74ยตs | 192.168.1.197 | OPTIONS "/stream/Groch-CAM2/channel/0/webrtc"
INFO[2022-05-26T08:54:16+02:00] Run stream call=Run channel=0 func=StreamServerRunStreamDo module=core stream=Groch-CAM2
INFO[2022-05-26T08:54:17+02:00] Success connection RTSP call=Start channel=0 func=StreamServerRunStream module=core stream=Groch-CAM2
2022/05/26 08:54:17 Set ICEServers [stun:stun.l.google.com:19302]
ERRO[2022-05-26T08:54:17+02:00] SetRemoteDescription called with no ice-ufrag call=WriteHeader channel=0 func=HTTPAPIServerStreamWebRTC module=http_webrtc stream=Groch-CAM2
[GIN] 2022/05/26 - 08:54:17 | 400 | 829.242677ms | 192.168.1.197 | POST "/stream/Groch-CAM2/channel/0/webrtc"
INFO[2022-05-26T08:54:57+02:00] Stream exit by signal or not client call=StreamServerRunStream channel=0 func=StreamServerRunStreamDo module=core stream=Groch-CAM2
What did you already try to solve it?
I've tried to change various RTSPtoWeb options in configuration without luck...
Have you tried running in safe mode?
No matters
Did running in safe mode solve the problem?
No matters
Systeminfo Bundle
You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
At the moment, the only webrtc stream that works (as far as I know) is one provided by aiortc. This is what the implementation was based around.
This limitation is because there is no standard signalling protocol to setup the stream. In the RTSPtoWeb repository it has the source to the demo page, which you can find some of the JS code it uses to connect the stream:
We intend to create a proper plugin interface for the webcam streaming setup to make it really easy for people to add support for other streaming types in the future. My current recommendation is to either create a custom plugin to stream on a separate tab for example, adapting the demo code they provided or, if you don't mind the latency, switch to HLS streaming as that should be a common standard.
I did just think of one other option - embedding the RTSPtoWeb demo page in an iframe:
I do also have it on my list to create a proper guide/add to the documentation a part about OctoPrint and webcam streaming but have not yet had time.
OK, thanks... So I've used same RTSPtoWeb server but with hlsll output used in OctoPrint webcam url. It works OK for now. I will be checking time to time in future OctoPrint versions if WebRTC support is fixed
I will stay with RTSPtoWeb, becouse it is doing no re-encodig - h.264 stream is untouched, just transport is changed. Rtsp2mjpg will do recompression what is not acceptable on my RPI Zero OctoPi
Hello. I share your interest in RTSPtoWeb for its small footprint and minimal CPU usage. can you elaborate on how you went about making this work? I am able to host the web server and see the streams at http://MYIP:8083, but haven't been able to show the stream in octoprint from there. thanks!
assuming you updated your stream URL in OctoPrint's settings, it may be related to browser security. how are you accessing your OctoPrint instance? if the address starts with https:// rather than http:// then it could block the cross-site access (CORS). If that is the case you'll see an error in the developer tools console tab in your browser on initial page load or when you go to the control tab.
one other possibility is the webserver doesn't like cache busters and there's an option in webcam settings you can turn off to disable that in OctoPrint under the advanced options.
thanks for the advice. seems that for me, using jneilliii's Webcam Iframe plugin (thanks!) with the RTSPtoWeb (Http://IP:8083/pages/player/webrtc/CAM_ID/0 as the URL) works best for me. I do have to occasionally scroll in the Iframe, but it gives we almost no latency and minimal CPU usage. I have been running RTSPtoWeb on a separate pi4 that is on ethernet, again to keep the CPU usage of my PiZero2 running octoprint to a minimum.