title: HTML 5 video recording and storing a stream
body: <p>Using Html 5 I want to record video and save the stream into a local file. Given below is the code. In a button click it already invokes the camera and captures the video in the 'VIDEO' tag of HTML. Can I store the stream into a local file? Or can I store it as MP4 file? </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;script type="text/javascript"&gt;
  
  function enter() {
  
      if (navigator.mozGetUserMedia) { 
         navigator.myGetMedia=navigator.mozGetUserMedia;
         navigator.myGetMedia({video: true}, connect, error); 
      } 
      else {
         alert("NO");
      }
  
      function connect(stream) {
  
          var video = document.getElementById("my_video");
              video.src = window.URL ? window.URL.createObjectURL(stream) : stream;
              video.play();
  
          var canvas = document.getElementById("c"); 
      }
  
      function error(e) { console.log(e); }
  
  }
  
  &lt;/script&gt;
  
  &lt;/head&gt;    
  &lt;body&gt;
      &lt;canvas width="640" height="480" id="c"&gt;&lt;/canvas&gt;
      &lt;input type="button" value="RECORD" onClick="enter()"/&gt;
      &lt;input type="button" value="SAVE" /&gt;
      &lt;video id="my_video" width="640" height="480"/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to save the stream upon a save button click.</p>