agsh / rtsp-ffmpeg

Node.js FFMpeg wrapper for streaming RTSP into MotionJPEG
MIT License
249 stars 84 forks source link

About Currupted Img #18

Open Caraws opened 6 years ago

Caraws commented 6 years ago

Hi, I try to use dynamic link to change the camera screen. But the result is this

img

qq 20170801162202

this is my code

var rtsp = require('rtsp-ffmpeg');
var uri = 'rtsp://xxxx:xxxx@192.168.0.64:554/h264/ch1/main/av_stream',
    stream = new rtsp.FFMpeg({
        input: uri,
        rate: 10,
        resolution: '640x480',
        quality: 3
    });

 io.on('connection', socket => {
  console.log('connection')
    var pipeStream = function(data) {
      socket.emit('data', new Buffer(data).toString('base64'));
    };
    stream.on('data', pipeStream);
    socket.on('URI', data => {
      console.log(data);
      uri = `rtsp://${data.userName}:${data.passWord}@${data.ip}:${data.RTSP}/h264/ch1/main/av_stream`
      stream.input = uri;
      console.log(stream.input)
      stream.restart()
    })
    socket.on('disconnect', function() {
      stream.removeListener('data', pipeStream);
    });
}) 

please tell me where am i wrong. :)

Seikon commented 6 years ago

Thre is a new version on the master branch, you can test the code for cropped images. This may be caused for quality parameter, because some cameras does not support this option and produce cropped images.

wraysu commented 6 years ago

Hello I have the same problem. I have updated the newest version. But the image is still corrupted like below! image

Caraws commented 6 years ago

@wraysu Hi, I still has this problem, but you can try to change video streams into sub streams, some times it's work for me