[beta testing] nodes for live streaming mp4

Hi. Im using exec node for my rtsp url which is ffmpeg -loglevel quiet -rtsp_transport tcp -i rtsp://xxxx@192.168.1.xxx:554//h264Preview_01_main -an -c:v copy -f mp4 -movflags +frag_keyframe+empty_moov+default_base_moof pipe:1. and connect the node to mp4frag and ui_mp4frag nodes by Kevin Godell. After deploy i only see video playback ready sign at dashboard. How to solve this?

Your rtsp url. Does it work in VLC?. I do not have rtsp cameras myself but the link below normally works (when the camera is available). Try your rtsp url first in VLC, if it doesn't work there, no idea to try further until fixed. Also check how you have configured the ui_mp4frag node

ffmpeg -loglevel quiet -rtsp_transport tcp -i rtsp://freja.hiof.no:1935/rtplive/_definst_/hessdalen03.stream -an -c:v copy -f mp4 -movflags +frag_every_frame+empty_moov+default_base_moof -min_frag_duration 500000 pipe:1

i already fix it. i move the mp4 to the top of the order. and it display on dashboard. just sometime the video stream dont have a good quality

mp4 is mp4
Quality is best when there is less movement in view. Principle for mp4 is to transfer not complete images but the difference from frame to frame. Check now what durations you get. Eventually reduce duration and resolution in camera setting. Try socket.io and see if it is better

i see. thank you for the info. where to check the duration?

You see it at the mp4frag nodes when the stream is running. How to change in the camera setting is camera device specific, if possible. The ultimate goal is to have short durations to reduce delay in view related to the actual real world

image

okay thank you very much

Hi @kevinGodell , do you think you will simplify the installation of your Nodes. Going through the Palette would be so Noob friendly.
And also to avoid using the Exec node would be great. :pray:

You read my mind. I was thinking the same thing when the latest user was trying to install the nodes.

Yes, I also need to make an ffmpeg node also that can monitor its progress and handle more output pipes than stdout/stderr.

Unfortunately, all of my free time has been tied up with an authentication node that I had to rebuilt from scratch 3 times now because it was never satisfactory. I think I am finally on the right path with it and I am trying to clean it up.

5 Likes

happy to have read your mind. This is good news for all of us. all we have to do is wait :smiley:

I just remembered why I haven't gotten around to publishing the nodes, other than my laziness. I am currently waiting for node-red-dashboard to upgrade to socket io v3. It may be happening within a month or 2 based on this comment from @dceejay Socket.io, migrating from 2.x to 3.0 - #11 by dceejay.

At the very least, I took some time to clean up and publish mp4frag@0.3.0, which is used by node-red-contrib-mp4frag to parse the data spewed out of ffmpeg.

3 Likes

Hello everyone,

In this moment i can do a mp4 file with good quality and a live stream on dashboard. However, live stream flashes a lot.
I already tried to install Odells nodes but without sucess.

In this moment i have this:

Someone can give some help?
The camera is a reolink rlc 410

There are a couple things wrong here, but they can easily be fixed.

You are trying to stream jpegs, not mp4, for now. We have to fix the ffmpeg command to reflect that. Remove the hls_time and hls_wrap flags. Realistically, you should rate limit the jpeg output, otherwise you might run a high cpu load decoding all of the mp4 frames and encoding them to individual jpegs. To add a rate limit, you can pass -vf fps=fps=2 right in front of pipe:1. This would reduce the jpegs to 2 frames per second. If your cpu load is still too high, there are other things we can try.

The other issue is that the jpeg that is coming out of the exec node has to be buffered until it is a complete file. Based on our previous conversation about it flashing, you are probably receiving partial jpegs. Install my node, node-red-contrib-pipe2jpeg attach it to the first output of exec node, and then attach the other nodes to its output.

Once we get your jpeg issue fixed, we can look into mp4 streaming as an addition or alternative to the jpegs.

1 Like

Now i have this:


The image is not very good yet

And the command in this moment is:
ffmpeg -f rtsp -i "rtsp://andre:913558828Aa@192.168.50.240:554/h264Preview_01_sub" -f image2pipe -hls_time 3 -hls_wrap 10 -q 2 pipe:1 -vf fps=fps=2

However, with that command to decrease cpu load, i have this:

Can you explain what is "no good" with image??

Also, please read carefully what is recommended:

This is not what you did but maybe it works anyway??

should be
ffmpeg -f rtsp -i rtsp://andre:913558828Aa@192.168.50.240:554/h264Preview_01_sub -f image2pipe -q 2 -vf fps=fps=2 pipe:1

and image preview node should also be plugged into pipe2jpeg.

And why not?? Streaming mp4 correctly will not load the cpu that much (33% is really too much for 2 fps).

This whole thread is about live streaming mp4 so please try again to install the nodes and explain why it doesn't work

Good morning,

I changed the command and now the problem of CPU load is solved, i think.

Now the problem is the quality of image. If i have ".....01_sub..." the qualityis a little bad

if i change to ".....01_main.." the quality is much better

However, in both cases, the image transmission is very slow and have a lot of breaks.

About instalation, i can' install because i have the following messages

I'm not a expert in node-red yet, so i'm sorry if i'm asking stupid questions :confused:

My setup seems much different from yours. I have to run the npm install command from within the .node-red directory. Like yourself, I am also not a node-red expert. Maybe you don't have the node-red-dashboard installed?

@Andrefs

the camera is connected in wifi? in ethernet? the router is far? you go through a switch etc ...

yes : you have to enter this 3 lines in the Terminal :

cd .node-red
npm install kevinGodell/node-red-contrib-mp4frag
npm install kevinGodell/node-red-contrib-ui-mp4frag

Did you test your RTSP adress : rtsp://andre:913558828Aa@192.168.50.240:554/h264Preview_01_main
in a playing media software like VLC , to see if there is breaks to ?