// 监控录像
app.get('/thumbnail/:type', (req, res) => {
res.set('Content-Type', ' image/png');
//define file path,time to seek the beegining and set ffmpeg binary
var folder = 'public/thumbnail/';
var filename = 'cam1_' + Date.now();
console.log(1);
var proc = ffmpeg(`rtsp://admin:admin12345@10.10.1.20${req.params.type}:554/Streaming/Channels/101`)
.withFrames(1)
.format('apng')
.on('filenames', function (filenames) {
console.log('Will generate ' + filenames.join(', '))
})
.on('end', async function () {
console.log('Screenshots taken');
})
.on('error', function (err) {
console.log('an error happened: ' + err.message);
}).pipe(res, { end: true })
});
网友评论