title: How to export fabricJS canvas in video format like mp4 with sound?
body: <p>I'm trying to create an app using fabricJS which would allow the user to add a video on the canvas and some texts on it. I have achieved this till adding video &amp; texts on the canvas. but I can't get any idea to export the canvas to mp4 format.</p>
  
  <p>The expected output is like, video is playing in background and there is a text on the video at a speific position.</p>
  
  <p>is there any solution that can help me to achieve this?</p>
  
  <p>There's a video added on the canvas, I want to export this canvas including the sound of video.</p>
  
  <p>here is the snippet</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
  
      canvas = new fabric.Canvas('c');
      canvas.setWidth(480);
      canvas.setHeight(360);
  
      var video1El = document.getElementById('video1');
      var video1 = new fabric.Image(video1El, {
        left: 0,
        top: 0
      });
  
      canvas.add(video1);
      video1El.load();
  
      $(document.body).on('click', '#play' ,function(){
       var iText = new fabric.IText("sample text", {
                  fill: 'red',
                  fontSize: 60,
                  left: 10,
                  top: 10
              })
              canvas.add(iText);
          video1El.play();
      });
      
      $(document.body).on('click', '#exportvideo' ,function(){
       //code to export canvas as video
      });
  
      fabric.util.requestAnimFrame(function render() {
        canvas.renderAll();
        fabric.util.requestAnimFrame(render);
      });
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.2.3/fabric.min.js"&gt;&lt;/script&gt;
  &lt;button id="play"&gt;play&lt;/button&gt;
  &lt;button id="exportvideo"&gt;Export as video&lt;/button&gt;
  &lt;canvas id="c" width="300" height="300"&gt;&lt;/canvas&gt;
  &lt;video crossorigin="anonymous" id="video1" style="display: none" class="canvas-img" width="480" height="360"&gt;
    &lt;source id="video_src1" src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4"&gt;
  &lt;/video&gt;</code></pre>
  </div>
  </div>
  </p>