I'm trying to stream video captured from my webcam using open cv (c++) to my Node.js server using web sockets.
Here's what I got so far:
- I'm capturing (and analyzing frames) with OpenCV (C++).
- Successfully using Microsoft's cpprest lib to send and receive messages between my c++ application capturing the webcam frames, to my nodejs server.
What I think I should:
Would sending each frame captured in my c++ while loop to my node server though web sockets be the most optimal way of streaming video? Or is there a better way?
Note that I'm trying to stick to my node.js server, so I'm guessing web sockets is the correct route to take?
Web sockets are fine, and nothing wrong with node- it makes things easy. You should consider compressing that stream before sending it otherwise you will have a pretty massive throughput depending on the resolution.
If you don't need realtime (or you are okay with a bit of lag time) you should consider bundling the data into packets(don't send a continuous stream, send bursts of larger data instead) for the sake of efficiency