Trying very hard to find some free time for Node-RED again...
Some time ago @kevinGodell has done a tremendous effort to try to teach me the basics decoding rtsp streams in another discussion:
I really appreciate all his hard labour!!
But now I am struggling to get a hold on the technical details.
My first problem is about the output chunks. The output pipes of the child process have OS limitations, so as a result the output data is splitted into chunks (e.g. 65K size on a Raspberry Pi). Two questions about this:
If the output are jpeg images, then I need to use a node-red-contrib-pipe2jpeg node to join those chunks again to create a complete jpeg image. I see here in the pipe2jpeg dependency that the EOF can be anywhere inside the chunks. Which means that those chunks have to split into two chunks again: the first chunk part belongs to the previous jpeg while the second chunk part belongs to the current jpeg. Which will result in a lot of searching through the buffers and doing repetitive buffer concatenations, i.e. a lot of cpu and ram usage.
But when I look at this code from the rtsp-ffmpeg library, I see that it simply detects the EOF at the end of the chunk. So no searching of the EOF inside the chunks required and no buffer concatenations. Which requires much less cpu and ram.
When I use that code snippet from the rtsp-ffmpeg library in my flow, it seems to be working very well. I.e. I see fluid images arriving in my flow.
So now I am wondering if I am just lucky that my EOF's are always at the end of my chunks, and not somewhere inside my chunks? I really have no clue...
As explained above the node-red-contrib-pipe2jpeg does a very well job to join chunks of data into complete jpeg images. However when the output of my spawn node will contain h.264 segements (instead of images), then those segments are also splitted by the OS limitations into chunks. Not sure at the moment how I can combine those chunks to get the original complete segments again. When I send those chunks immediately to the mp4 frag node, the separate chunks seem to be no problem for that node. Again no clue how this works...
Hopefully somebody can answer my question, because my head is exploding
Warning: as soon as these chunk related questions are answered, I have 'some' other technical questions about the rtsp streams