1

I need to be able to stream webcam video (and audio) from a browser to a node.js server via socket.io. I know it's possible to send individual frames as images, but it needs to be properly encoded, preferably H.264.

I have looked at APIs like OpenTok, but that requires a subscription and goes through a cloud. Is it possible to send encoded video over socket.io in JavaScript, maybe using WebRTC?

wumbo
  • 746
  • 9
  • 21
  • 2
    socket.io is not really built for this. It's a message passing protocol, not a streaming protocol. Why must you use socket.io. You could use socket.io to push a URL to the client and have the client request the URL and then use one of the built-in video streaming mechanisms in the browser to play that URL. – jfriend00 May 11 '16 at 23:46
  • 1
    The question was about streaming from the client to the server, not the other way around. – wumbo May 12 '16 at 23:11
  • 1
    Related questions: [Stream recorded audio from browser to server](http://stackoverflow.com/questions/20850396/stream-recorded-audio-from-browser-to-server), [Sending camera video from browser to server](http://stackoverflow.com/questions/9221876/sending-camera-video-from-browser-to-server). Just so you know, asking for a library solution to a problem is considered off-topic here. – jfriend00 May 13 '16 at 00:56
  • 1
    Thanks @jfriend00, that second question looks like exactly what I need. I will rephrase the question to ask for a JavaScript solution rather than library solution in case someone finds this useful. – wumbo May 17 '16 at 02:22

1 Answers1

0

What you can do u can install opencv4nodejs on you node package and can grab a single image from the webcam and on a single image fuction whuch grabs the image set a Settimeout method with 144 frame per seconds by this you can send an image through socket io as you apllied refreshing rate of 144 then it will look like a video

  • 6
    Welcome to Stack Overflow! Whilst your answer may be technically correct please edit to include relevant code examples instead of purely describing the code they should implement. Use relevant code blocks so that the answer is clearly structured and easy to follow. If you take this care when adding an answer you are more likely to have your answer upvoted and accepted. Thank you for helping our fellow developers! – Dan Mason Apr 11 '20 at 19:42