title: How to recorder a RTSP Stream
body: <p>I'm using the <code>node-rtsp-stream</code> package and Websocket to make the transmission of my IP-Camera, and the visualization happens well, now I'd like to know how to record this transmission and I have no idea how to do this.</p>
  
  <p>index.js in Server-side(NodeJS)</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>const Stream = require('node-rtsp-stream'),
    stream = new Stream({
      name: 'Garage-Camera',
      streamUrl: `rtsp://${meu_ip}:1030/user=${user}&amp;password=${pass}&amp;channel=1&amp;stream=0.sdp?`,
      wsPort: 5000
    })</code></pre>
  </div>
  </div>
  </p>
  
  <p>in client-side</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-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;canvas id="videoCanvas"&gt;&lt;/canvas&gt;
  &lt;/div&gt;
  &lt;script src="jsmpeg.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    const ws = new WebSocket("ws://localhost:5000")
    const player = new jsmpeg(ws, {
      canvas: document.querySelector('#videoCanvas'),
      autoplay: true,
      audio: false,
      loop: true
    })
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>