Send video stream/images to a websocket server
<p>I'm developing an application that processes images.  Having a HTML front-end I have to capture images from the webcam (using <em>video</em> tag) and send them to the server continuously.  Then images are going to be analyzed and when the objects are detected (x, y, z) points are going to be send back to the client.</p>

<p>I have 2 approximations now:</p>

<p>1.- Capture frames constantly (using an invisible canvas and previously loading there the frame) and send them to the server with Base64 encoding. (E.g <a href="https://stackoverflow.com/questions/19175174/capture-frames-from-video-with-html5-and-javascript">Capture frames from video with HTML5 and JavaScript</a>)
<br/>Pros:<br>
- Easy to implement.<br>
<br/>Cons:<br>
- Very slow. Many images are going to be sent continuously and should be handled very fastly.  (In this case images has to be saved when they arrive and deleted after processing)<br>
<br>
2.- Send video stream and process all frames in the server.
<br/>Pros:<br>
- Data is sent very fast.<br>
<br/>Cons:<br>
- Complex.  I don't know how to implement it.<br>
<br></p>

<p>Any tips in how can I make it?</p>