Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bartbutenaers/node-red-rtsp-to-mjpeg

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bartbutenaers/node-red-rtsp-to-mjpeg

A Node-Red nodeton convert an RTSP stream to an MJPEG stream

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@bartbutenaers/node-red-rtsp-to-ffmpeg

A Node-RED node to convert an RTSP stream to an MJPEG stream

Install

Run the following npm command in your Node-RED user directory (typically ~/.node-red):

npm install @bartbutenaers/node-red-contrib-rtsp-to-mjpeg

Support my Node-RED developments

Please buy my wife a coffee to keep her happy, while I am busy developing Node-RED stuff for you ...

Buy my wife a coffee

Node usage

Some modern IP cameras don't offer MJPEG streams anymore, but instead only support RTSP streams. While RTSP is a modern protocol (that carries audio with modern encoding), it is convenient in some use cases to have an MJPEG stream. For example to easy visualize the containing JPEG images, or to execute image processing (like motion or object detection).

In those cases this node can be used to connect to the IP camera via RTSP, and then convert the RTSP stream to an MJPEG stream (using Ffmpeg):

image

The following example flow demonstrates how the conversion can be started by injecting a message with msg.topic = 'start_conversion', and stopped by msg.topic = 'stop_conversion':

image

[{"id":"b96896ea3aeb4aa3","type":"rtsp2mjpeg","z":"d559c7069178d672","url":"rtsp://192.168.1.21:554/h264Preview_01_sub","username":"your_username","password":"your_password","rate":"","quality":"","resolution":"","x":550,"y":560,"wires":[["08b85c516eae4ea0"]]},{"id":"2daebe66eab7d6bc","type":"inject","z":"d559c7069178d672","name":"Start conversion","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start_conversion","x":340,"y":560,"wires":[["b96896ea3aeb4aa3"]]},{"id":"e2cfd9118ee0fa29","type":"inject","z":"d559c7069178d672","name":"Stop conversion","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stop_conversion","x":340,"y":620,"wires":[["b96896ea3aeb4aa3"]]},{"id":"08b85c516eae4ea0","type":"debug","z":"d559c7069178d672","name":"debug 388","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":560,"wires":[]}]

Limitations

This node causes high CPU consumption on my Raspberry Pi 4, which is kind of normal because decoding a H264 stream and encode it again to jpeg images.

Reducing the frame rate in the config screen reduces the number of frames send by this node every second, but the CPU usage will keep high. As a result, you can also reduce the number of images per second using a standard Delay node:

image

[{"id":"36569f3e1dc4bcba","type":"rtsp2mjpeg","z":"d559c7069178d672","url":"rtsp://192.168.1.21:554/h264Preview_01_sub","username":"your_username","password":"your_password","rate":"","quality":"","resolution":"","x":350,"y":280,"wires":[["3896a5dda2731fe8"]]},{"id":"b581861983e59964","type":"inject","z":"d559c7069178d672","name":"Start conversion","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start_conversion","x":140,"y":280,"wires":[["36569f3e1dc4bcba"]]},{"id":"a37012de657e6d44","type":"inject","z":"d559c7069178d672","name":"Stop conversion","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stop_conversion","x":140,"y":340,"wires":[["36569f3e1dc4bcba"]]},{"id":"3896a5dda2731fe8","type":"msg-speed","z":"d559c7069178d672","name":"","frequency":"sec","interval":1,"estimation":false,"ignore":false,"pauseAtStartup":false,"topicDependent":false,"x":550,"y":280,"wires":[[],["a6964968f634e832"]]},{"id":"c323f201f1275a9e","type":"image","z":"d559c7069178d672","name":"","width":"400","data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":false,"outputs":0,"x":940,"y":280,"wires":[]},{"id":"a6964968f634e832","type":"delay","z":"d559c7069178d672","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":750,"y":280,"wires":[["c323f201f1275a9e"]]}]

Remark: this example flow also uses a node-red-contrib-msg-speed speed node, and a node-red-contrib-image-output node.

Node properties

URL

Enter the RTSP URL that starts with rtsp:// to connect to the IP camera.

Username

Enter the (optional) username to authenticate in the camera.

Password

Enter the (optional) password to authenticate in the camera.

Frame rate

The frame rate i.e. number of images per second.

Quality

The quality setting of the output images.

Resolution

The resolution (i.e. width x height in pixels) of the output images.

Keywords

FAQs

Package last updated on 07 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc