ScarletsFiction / SFMediaStream

HTML5 media streamer library for playing music, video, playlist, or even live streaming microphone & camera with node server
MIT License
101 stars 30 forks source link

Use node to relay RTSP stream and decode it with SFMediaStream? #28

Open Leone25 opened 1 year ago

Leone25 commented 1 year ago

Hello,

is there anyway to use the node server to "proxy" a RTSP stream to the browser trough websocket and then use SFMediaStream to decode and display it?

I saw yeellowstone which might be used to connect to the RTSP server, but I'm not sure how to transform the data to something that SFMediaStream would be able to understand.

Thank you in advance

Rico

StefansArya commented 1 year ago

Hi, Sadly I also not sure it will work or not, but it's quite interesting feature to be added. Especially if we can use raw TCP or UDP (still an unofficial draft), we may no longer need to create a proxy.

I also think it's better to find something like RTSP to WebRTC 🤔 and then just play the stream into <audio> or <video>

like rtsp-relay, RTSPtoWebRTC or RTSPtoWSMP4f

after it's playable on the browser, we can do further processing with this library

Leone25 commented 1 year ago

Well I've been trying to avoid WebRTC as it's a pain to set up a TURN server, plus I don't need the scalability.

I did look into RTSPtoWSMP4f, and it works but it's very unstable, plus it's in golang and I'm not the best at it. I looked into rtsp-relay too, but it uses ffmpeg in the backend to convert the video and 1. requires a decent server to run, especially if I want to run a couple of video feeds in parallel 2. looses a lot of quality in the process.

What I was thinking rather than handling the RTSP protocol frontend, is to actually let the node js server take care of it, and only send the video data trough the websocket then pass that to SFMediaStream. I hope that makes sense