3

I am using the node-rtsp-stream package to run rtsp streaming. How can i implement and callback it in mvc structure

Controller:

var RTSP = require('./models/rtsp.js');
var startRTSP = function startRTSP(queryData) {
  console.log("startRTSP enterred******************")
  console.log("queryData : "+JSON.stringify(queryData))
  stream = new Stream({
    name: 'name',
    streamUrl: 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov',
    wsPort: 9999
  });
};

Models:

router.get('/', function(req,res){
       RTSP.startRTSP(req.body);
       res.send("SUCCESS")
})     

Views:

$.ajax({
    url:'/',
    type:'POST',
    cache:false,
    success:function(data){
        console.log("RTSP Result  : "+JSON.stringify(data)
        var canvas = document.getElementById('rtspvt');
        var ws = new WebSocket("ws://localhost:9999")
        var player = new jsmpeg(ws, {canvas:canvas, autoplay:true,audio:false,loop: true});
    }
});
InSync
  • 4,851
  • 4
  • 8
  • 30
Shree
  • 145
  • 4
  • 15

1 Answers1

0

install ffmpeg globally in your system first.

And import ffmpeg npm package let ffmpeg = require('ffmpeg');

now try to stream

stream = new Stream({
      name: "name",
      streamUrl: url, // rtsp url
      wsPort: port,  // ws port
      ffmpegOptions: { // options ffmpeg flags
        '-stats': '', // an option with no neccessary value uses a blank string
        '-r': 30 // options with required values specify the value after the key
      }
    })
Zoe
  • 27,060
  • 21
  • 118
  • 148
goarun112
  • 16
  • 1
  • 3