How to record RTSP stream

0

I am using the package node-rtsp-stream more Websocket to make the transmission of my IP-Camera, and the visualization happens well, now I would like to know how to record this transmission and I have no idea how to do this.

index.js on Server (NodeJS)

const Stream = require('node-rtsp-stream'),
  stream = new Stream({
    name: 'Camera-Garagem',
    streamUrl: 'rtsp://${meu_ip}:1030/user=${user}&password=${pass}&channel=1&stream=0.sdp?',
    wsPort: 5000
  })

index.html on the Client

<div>
  <canvas id="videoCanvas"></canvas>
</div>
<script src="jsmpeg.js"></script>
<script>
  const ws = new WebSocket("ws://localhost:5000")
  const player = new jsmpeg(ws, {
    canvas: document.querySelector('#videoCanvas'),
    autoplay: true,
    audio: false,
    loop: true
  })
</script>
    
asked by anonymous 01.01.2019 / 16:05

1 answer

1

You can take a look at this library

link

const Recorder = require('node-rtsp-recorder').Recorder

var rec = new Recorder({
    url: 'rtsp://${meu_ip}:1030/user=${user}&password=${pass}&channel=1&stream=0.sdp?',
    timeLimit: 60, // time in seconds for each segmented video file
    folder: '/node-rtsp-recorder/videos',
    name: 'cam1',
})
// Starts Recording
rec.startRecording();

setTimeout(() => {
    console.log('Stopping Recording')
    rec.stopRecording()
    rec = null
}, 300000)

It allows you to record the recording and store it on the server disk, then you can implement some kind of logic / route to download that video if necessary.

    
01.01.2019 / 16:54