[英]How to recorder a RTSP Stream
I'm using the node-rtsp-stream
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.我正在使用node-rtsp-stream
包和Websocket进行我的IP-Camera的传输,并且可视化进行得很好,现在我想知道如何记录此传输,但我不知道如何执行此操作.
index.js in Server-side(NodeJS)服务器端的 index.js(NodeJS)
const Stream = require('node-rtsp-stream'), stream = new Stream({ name: 'Garage-Camera', streamUrl: `rtsp://${meu_ip}:1030/user=${user}&password=${pass}&channel=1&stream=0.sdp?`, wsPort: 5000 })
in client-side在客户端
<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>
you can use the node-rtsp-recorder library and it's very simple to use it.您可以使用node-rtsp-recorder库,使用起来非常简单。
recording example录音示例
const Recorder = require('node-rtsp-recorder').Recorder
var rec = new Recorder ({
url: 'rtsp://192.168.1.12:8554/unicast',
timeLimit: 60, // time in seconds for each segmented video file
folder: __dirname,
name: 'cam1',
})
// Starts Recording
rec.startRecording();
setTimeout (() => {
console.log('Stopping Recording')
rec.stopRecording()
rec = null
}, 300000)
image capture example图像捕捉示例
const Recorder = require('node-rtsp-recorder').Recorder
var rec = new Recorder ({
url: 'rtsp://192.168.1.12:8554/unicast',
folder: __dirname,
name: 'cam1',
type: 'image',
})
rec.captureImage (() => {
console.log('Image Captured')
})
Hope this helps :)希望这可以帮助 :)
This library might help rtsp-video-recorder .这个库可能有助于rtsp-video-recorder 。
In case of any question, suggestion or feature request you may contact me trough the github issue tab如果有任何问题、建议或功能请求,您可以通过github 问题选项卡与我联系
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.