chriswiggins / rtsp-streaming-server

Lightweight RTSP/RTP streaming media server written in Javascript
GNU General Public License v3.0
107 stars 21 forks source link

Unhandled promise rejection (rejection id: 1): Error: Mount does not exist #13

Open anuranBarman opened 5 years ago

anuranBarman commented 5 years ago

I am trying to use this in NodeJS application. But getting the following error when trying to play the stream from VLC. the ffmpeg command also mentioned in the README ( ffmpeg -i demo.mp4 -c:v copy -f rtsp rtsp://127.0.0.1:5554/stream1 ) is executing but stopping after showing the metadata options. The error I am getting is below:

(node:87706) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Mount does not exist
(node:87706) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js proc
ess with a non-zero exit code.
chriswiggins commented 5 years ago

Hmmmm. Strange @anuranBarman!

Can you show your JS source so I can have a look?

anuranBarman commented 5 years ago

I am justing using the demo source you have provided:

const RtspServer = require('rtsp-streaming-server').default;

const server = new RtspServer({
    serverPort: 5554,
    clientPort: 6554,
    rtpPortStart: 10000,
    rtpPortCount: 10000
});

server.start().then(() => {
    console.log('server is running');
}).catch((err) => {
    console.log(err);
})
Gronis commented 4 years ago

I have the same issue. Also using javascript. I push the video stream with gstreamer using this command:

gst-launch-1.0 videotestsrc ! queue ! x264enc ! rtspclientsink location=rtsp://127.0.0.1/stream1

I also use the example in README. Get the same error:

Unknown ClientServer request { method: 'ANNOUNCE', url: undefined }
(node:1) UnhandledPromiseRejectionWarning: Error: Mount does not exist
     at new ClientWrapper (/usr/src/app/node_modules/rtsp-streaming-server/build/lib/ClientWrapper.js:26:13)
     at ClientServer.setupRequest (/usr/src/app/node_modules/rtsp-streaming-server/build/lib/ClientServer.js:161:23)
     at processTicksAndRejections (internal/process/next_tick.js:81:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Gronis commented 4 years ago

It seems like the whole rtsp protocol is not implemented. The missing commands are ANNOUNCE, RECORD, GET_PARAMETER, SET_PARAMETER and REDIRECT.

From ClientServer.ts

    this.server = createServer((req: RtspRequest, res: RtspResponse) => {
      debug('%s:%s request: %s', req.socket.remoteAddress, req.socket.remotePort, req.method);
      switch (req.method) {
        case 'DESCRIBE':
          return this.describeRequest(req, res);
        case 'OPTIONS':
          return this.optionsRequest(req, res);
        case 'SETUP':
          return this.setupRequest(req, res);
        case 'PLAY':
          return this.playRequest(req, res);
        case 'TEARDOWN':
          return this.teardownRequest(req, res);
        default:
          console.error('Unknown ClientServer request', { method: req.method, url: req.url });
          res.statusCode = 501; // Not implemented
          return res.end();
      }
    });

See rtsp protocol

chriswiggins commented 4 years ago

@Gronis you’re looking at the wrong file. The ClientServer and PublishServer have different protocol support.

https://github.com/chriswiggins/rtsp-streaming-server/blob/d03416103dfa58ed5e2cb4b322bfbf545098119f/src/lib/PublishServer.ts#L44

Based on your output, you’re sending your stream to the wrong port. Clients need to connect on the client port, and streams need to be published to the server port.

Your command needs to be: gst-launch-1.0 videotestsrc ! queue ! x264enc ! rtspclientsink location=rtsp://127.0.0.1:5554/stream1

Take note of the port.

I’ll double check the example with Gstreamer myself this morning and get back to you

chriswiggins commented 4 years ago

@Gronis this is working for me - Can you please try with the correct port and let me know if you're still having issues?

Gronis commented 4 years ago

Yea, I finally got it working yesterday. I had the ports mixed up. But I also have other problems related to my environment. I think it's safe to say that this problem was me using incorrect ports.

pglin66 commented 10 months ago

ffmpeg -f avfoundation -i "1:0" -vcodec libx264 -r 25 -s 1280x720 -f rtsp rtsp://127.0.0.1:5554/test Error: Mount does not exist