1

I've been looking for days a solution to convert a video stream (video/webcam) from a web browser to a backend RTSP stream. All I could find was backwards, from RTSP to WebSockets (to display in a web page). I want the user to choose from a web browser client, a video or webcam locally and then send it to a nodejs server. Opening a webcam and send the chunks via websockets, seems easy, but how to "convert" these chunks of video to a RTSP server, and then connect via VLC to see the stream ?

Thank you in advance.

Mrax
  • 63
  • 9
  • 1
    ffmpeg is great tool to convert media data. – Marc Nov 25 '21 at 08:11
  • Dear Marc, yes. Thank you. But as far as I know, it does not handle websockets. – Mrax Nov 25 '21 at 09:10
  • 1
    right, ffmpeg cant handle websockets. But you can write a node.js websocket server, which spawns a ffmpeg child process that does the video processing. – Marc Nov 25 '21 at 09:27
  • Marc, now that you threw a light over my problem, this makes so much sense! Thank you so much! I will research here, but would you have any code to get me started ? Anyways this seems to be the right answer!!! – Mrax Nov 25 '21 at 12:45
  • Suits not 100% your use case: https://stackoverflow.com/a/70086772/5781499 Implement a WebSocket server, create of the ws connection a stream (the `ws` module on npm can do both) pipe that stream into ffmepg stdin. Let me know if you need help or ask a seperate question an mention me in the comments. – Marc Nov 25 '21 at 13:09
  • Marc, in the words of Tina Turner, you're simply the best!! Can't thank you enough for your support! I am going to push myself to learn this and share with the community! I will let you know if I get stuck on some part of the code! Thaanks once again! – Mrax Nov 25 '21 at 15:58
  • Your welcome. Let me know if/how i can help you. – Marc Nov 25 '21 at 16:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/239584/discussion-between-mrax-and-marc). – Mrax Nov 25 '21 at 16:44
  • Marc, could you please take a look at the chat ? Thank you. – Mrax Nov 30 '21 at 09:59

0 Answers0