npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

v1.0.0

Published

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

Downloads

174

Readme

@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 ...

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.