fluent-ffmpeg express 截rtsp第一帧图

// 监控录像
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:[email protected]${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 })

});

你可能感兴趣的:(fluent-ffmpeg express 截rtsp第一帧图)