kyriesent / node-rtsp-stream

Stream any RTSP stream and output to websocket for consumption by jsmpeg (https://github.com/phoboslab/jsmpeg). HTML5 streaming video! Requires ffmpeg.
MIT License
451 stars 166 forks source link

ffmpeg too chatty #1

Closed genio closed 6 years ago

genio commented 9 years ago

FFMPEG dumps lots and lots of stuff to stderr. Adding -loglevel panic into the mix quietens that down quite a bit, but also causes node-rtsp-stream to stop functioning as it should when run as a service via systemd.

Application

Stream = require('node-rtsp-stream');
var stream1 = new Stream({
    name: 'ipcam1',
    streamUrl: 'rtsp://192.168.0.131:554/0',
    wsPort: 9991
});

systemd config file

[Unit]
Description=IP Camera viewer
Author=genio
Wants=nginx.service
After=nginx.service

[Service]
ExecStart=/bin/node /home/genio/streamer/app.js
Restart=always
StandardOutput=null
StandardError=syslog
SyslogIdentifier=ipcams
User=genio
Group=genio
Environment=PATH=/home/genio/bin:/usr/bin:/usr/local/bin:/bin
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

If I'm being dumb, please don't hesitate to point that out as I'm dumb quite often. I just don't like filling up /var/log/messages with tons of

frame=   30 fps= 29 q=31.0 size=     486kB time=00:00:00.93 bitrate=4261.3kbits/s

entries.

Thanks, Chase

kyriesent commented 9 years ago

@genio you're right; it's pretty verbose. I was trying to get as much debug data as I could at the time so I didn't mind it.

What exactly isn't working when you systemd-ize it? Is the client socket not picking up the data? Does it work without -loglevel panic? I can't imagine log levels changing the way that the app behaves with the websockets.

The library as-is is probably not really ready to be turned into a service without some work. You can feel free to fork and/or PR and I'd be happy to take it. It could use a verbosity option, should be fairly simple to add in via https://github.com/substack/minimist

FWIW, this was a side project that I haven't really touched for a few months (as you can tell); I'm not likely to jump back onto it for a little while. If I do I'm probably going to look at WebRTC too at the recommendation of a few others.

out4b commented 8 years ago

Hi, I'm using this library to stream video from an ONVIF camera to jsmpeg. I have the similar problem that if adding -loglevel panic to ffmpeg option, it will give me below error when jsmpeg page is launched in browser:

buffer.js:784
    throw TypeError('value is out of bounds');
          ^
TypeError: value is out of bounds
    at TypeError (<anonymous>)
    at checkInt (buffer.js:784:11)
    at Buffer.writeUInt16BE (buffer.js:819:5)
    at VideoStream.onSocketConnect (/home/brix/cdif-onvif-manager/lib/rtsp-stream/videoStream.js:112:18)
    at WebSocketServer.<anonymous> (/home/brix/cdif-onvif-manager/lib/rtsp-stream/videoStream.js:88:19)
    at WebSocketServer.EventEmitter.emit (events.js:95:17)
    at /home/brix/cdif-onvif-manager/node_modules/ws/lib/WebSocketServer.js:88:14
    at completeHybiUpgrade2 (/home/brix/cdif-onvif-manager/node_modules/ws/lib/WebSocketServer.js:271:5)
    at completeHybiUpgrade1 (/home/brix/cdif-onvif-manager/node_modules/ws/lib/WebSocketServer.js:296:13)
    at WebSocketServer.handleHybiUpgrade (/home/brix/cdif-onvif-manager/node_modules/ws/lib/WebSocketServer.js:324:3)
modelga commented 8 years ago

Hi, I've experiencing the same issue, did someone found a fix for that ?

kyriesent commented 8 years ago

Unfortunately I haven't seen anything that would help. :disappointed: Seems like the videoStream is trying to write a value to the Buffer that is invalid. But without knowing what that value is, I'm afraid I can't do much.

You could try to add a sanity check to the Buffer write, and discard values that are out of bounds. But unfortunately beyond that I'm not sure what will help. Sorry!

kyriesent commented 6 years ago

Stale issue, closing.

lbarkley1 commented 5 years ago

Firstly, I love how easy you have made it to stream an RTSP stream using node. I am getting a similar error to the other fellas - works fine when loglevel = info, but dropping it by a single log level (logLevel = error) the stream stops working without any errors stating why. The only output I get from this is within the browser:

[.WebGL-000002028C8DFBB0]RENDER WARNING: texture bound to texture unit 2 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

Can you suggest anything?