[beta testing] nodes for live streaming mp4

Ok then we are on-topic :wink:

It is already VERY positive that you ask yourself: "how to do this the Node-RED way ...". Because it would be very simple to add a bit of functionality to your node, to write mp4 files on disc. But then it becomes difficult/slow to let other nodes process the output of your node, which is the real power of Node-RED...

When talking about passing references via messages to other nodes, you have to be aware of a couple of things:

  1. pluggable message routing has become a reality in the new Node-RED 1.2. This allows Nick a.o. to develop a distributed Node-RED core in the (near??) future. Which means that a 'group' of nodes in your flow might be running on another host. Those nodes cannot access that object via that reference!

  2. When the output of your node is wired to N other nodes, then your original output message will be send across the first wire. But on the N-1 other wires you will get a clone of the original input message. So you will get N message instances all referring to the same mp4 fragment. If those nodes start manipulating the fragment, you will get some very odd results. Because each node assumes that it is working on a clone of the original mp4 fragment...

So IMHO you should send the mp4 fragment itself inside the output message to the next nodes, instead of only a reference! Then your fragment can e.g. be processed by nodes running on a remote machine...

Although this approach can have some disadvantages:

  1. When the user starts using multiple wires on an output, the mp4 fragment will be cloned. Which results in a performance drop. However IMHO that is up to the user. If you explain that on the readme page, he can decide by himself if he wants to use a long chain of nodes (with only 1-to-1 connections), or whether he starts creating 1-to-N wirings... That is the reason that I added outputs to some of my nodes, which passes the input message to the output (to allow chaining). For example my node-red-contrib-msg-speed node:

    image

  2. I don't know whether it is a problem if Node-RED starts cloning your mp4 fragment? If it is just a buffer of bytes, then there is no problem. But I know that e.g. OpenCv objects have there own clone method. Don't know how the object looks like in your case? Because currently custom cloning is not supported in Node-RED. I have done a proposal some time ago, but I haven't discussed further about it ...

Perhaps now I'm going really off-topic. But some time ago @hotNipi has created a very nice ui widget (node-red-contrib-ui-state-trail). And he has been so kind to implement a series of my feature requests, because I wanted to use it for showing time intervals for which recorded video footage was available. I see now that already somebody else has implemented that on his dashboard: see here.

image

Don't know if your API can allow such kind of stuff also? I mean that you send an input message with some search criteria (e.g. from_time and to_time), and that your node sends all the info of the recordings in the output message.
But perhaps i'm not interpreting your API correctly?

1 Like