title: c++ opencv webcam stream to html
body: <p>I am currently developing a project for my studies where I have to fetch a webcam stream, detect some objects and put some additional information on this stream. This is all done on the server side. </p>
  
  <p>Now I also have to provide the modified image of the stream to the clients. The clients just open a HTML file with the following content:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;It works!&lt;/h1&gt;
          &lt;video width="320" height="240" src="http://127.0.0.1:4711/videostream" type="video/quicktime" autoplay controls&gt;
              Your browser does not support the video tag.
          &lt;/video&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This will result in a HTTP request on the server for /videostream. To handle this request on the server side I will use Boost 1.56. </p>
  
  <p>Currently each frame of my webcam stream is of type <a href="http://docs.opencv.org/modules/core/doc/old_basic_structures.html" rel="noreferrer">IplImage</a>. Do I have to convert the IplImage into a video MIME-Typespecific format?</p>
  
  <p>I have tried to figure it out myself, how the whole thing is working, but I couldn't get it. I used Wireshark to analyze the communication, but it doesn't make sense. For testing purpose I have uploaded a video to my webspace and open the above file locally. The src of the video was the address of my webserver. First there is the TCP handshake stuff followed by this message:</p>
  
  <pre><code>HTTP    765 GET /MOV_4198.MOV HTTP/1.1 
  </code></pre>
  
  <p>Followed the following message (it contains connection: Keep-Alive in the HTTP part):</p>
  
  <pre><code>HTTP    279 HTTP/1.1 304 Not Modified 
  </code></pre>
  
  <p>Afterwards only TCP ACK and SYN folow, but no data. See the following picture:
  <a href="http://skullsplitter.lima-city.de/test.png" rel="noreferrer">see picture</a></p>
  
  <p>Where and how are the real data of the video sent? What have I missed here?</p>
  
  <p>Would be great if you could provide me some information about the connection between the Browser (video-Tag) and the C++ socket connection.</p>
  
  <p>Thank you,
  Stefan</p>