Thanks a lot, it works, bat I dont get a video, just an image. Mybe because of high quality. There is a way to show it in a lower quality and frame without change the camera setting?
Meanwile, I was even trying a workaround using python and ovc. I was able to open the rtsp stream in a dedicated windows without big effort and working really well, but I don't know how to point to this windows and put it inside the template node. It would be easy if ovc would open an http windws as motion does on linux.
Has your entire dashboard become unresponsive? Because when you send lot's of images per second (with high resolution) to your dashboard with @SuperNinja's solution, that won't work. All data will be send through a single websocket channel, and your browser most probably won't be able to deal with data. Simplest workaround is to throttle the datastream in your Node-RED flow (i.e. smaller images and less images per second).
Hi @BartButenaers , when you said :
my cameras are already set to 720p because in 1080p, like @Lupin_III, I only have still images or fragments of images.
Where can you set the image size and bit rate in Node-red?
i got only few nodes to display rstp streamming :
Yes defining the framerate and image size in the ffmpeg command would be best, but I have no idea at the moment how to do that. Only workaround I would have at the moment is to retrieve the large images at full speed from ffpmeg, and throttle and resize them afterwards in node-red by adding extra nodes. But then of course you are wasting a lot of cpu for decoding the stream, while you throw away lot of the data afterwards...
Bart , this topic got 19.4k views !
What do you do , go to work now !
Tried to install last night ffmpeg again on my raspberry, but it keeps failing due to segmentation errors. So unfortunately cannot test it ...
But following to this link, you could set an FPS of e.g. 7 frames per second like this:
ffmpeg -i rtsp://... -r 7 ...
And here is another link with another way to set both FPS and resolution.
Would be nice if somebody could do some tests and post the results in this discussion.
P.S. Using my node-red-contrib-msg-speed node, you can show the FPS in Node-RED. Indeed the number of messages per second is equal to the FPS, since each message contains a single image ...
Great ! i test -r 5
5 img/s, and works nicely in 720p
although the video quality is pixelated compared to VLC
- with the same
-r 5
but by selecting the 1080p stream: it is unusable! We do not see it on the capture but the image flashes and tries to be displayed but at the half, it is erased and starts again. In addition it can not stall on 5 img / s !?
- I noticed this peak , each time the stream starts, then stabilize :
Just one thing. If Im not wrong, setting -r after the input rtsp you're definig the option on the output. That means than the node works on all stream received and than shows just the output setting. Wouldn't be better the set the input option in order to avoid the worthless node working on all the input streaming?
Yes think you are right. If you see at the link in my previous post, you see this command:
ffmpeg -r 7 -i ...
Seems I made a copy paste error. It is a pity I cannot test it myself at the moment...
@Lupin_III @BartButenaers if i understand , this bad line
ffmpeg -f rtsp -i "rtsp://192.168.1.7:554/user=xxxxx_password=xxxxxx_channel=0_stream=1.sdp?real_stream" -r 5 -f image2pipe pipe:1
goes to :
ffmpeg -r 5 -f rtsp -i "rtsp://192.168.1.7:554/user=xxxxx_password=xxxxxx_channel=0_stream=1.sdp?real_stream" -f image2pipe pipe:1
with the -r 5
just after the ffmpeg . Right ?
Because i don't get the good result If i put -r 5
before::
If i put
-r 5
after: it's betterWell I think that my Stackoverflow link points to an incorrect non-working example.
Indeed when I look at the official ffmpeg ChangingFrameRate example,two things become clear:
- The
-r
option is an output option (as you already figured out) - Seems you could also use a filter
-filter:v fps=fps=7
to drop frames in between.
Perhaps you can achieve better results with the fps filter? Seems that the -r
option is applied AFTER the filter chain (where the fps filter is applied), so perhaps it is even better (for performance) if you drop the frames sooner using a filter. Then less processing is required for frames that you will drop anyway ...
[EDIT] the -r
option is applied after the filters, but before the encoding. So I think both options will be applied in the ffmpeg architecture at the next two locations:
I should say: the sooner you drop the frames, the better ...
Thanks Bart.
@SuperNinja, I don't know how to show the frame rate on the video, as you do. So, try to put a filter at the beginning as Bart suggests.
Thanks
@Lupin_III
you have to add this 3 nodes in the RTSP stream output.
[{"id":"e7882733.fd58a8","type":"msg-speed","z":"fe2c7bc6.bd49c8","name":"","frequency":"sec","estimation":true,"ignore":false,"x":440,"y":3540,"wires":[["3359b1d5.b8b7de","4829f33f.1f83dc","e8b1420c.5086b"],[]]},{"id":"3359b1d5.b8b7de","type":"ui_valuetrail","z":"fe2c7bc6.bd49c8","group":"7d9caa9a.53c694","order":4,"width":3,"height":1,"name":"","label":"","blur":false,"minmax":true,"colorLine":"#ff9900","colorFromTheme":true,"stroke":2,"pointcount":"24","x":610,"y":3530,"wires":[]},{"id":"4829f33f.1f83dc","type":"ui_text","z":"fe2c7bc6.bd49c8","group":"7d9caa9a.53c694","order":5,"width":1,"height":1,"name":"dash fps","label":"{{msg.payload}}fps","format":"","layout":"row-center","x":630,"y":3500,"wires":[]},{"id":"7d9caa9a.53c694","type":"ui_group","z":"","name":"camMisecu","tab":"250de740.57ee78","order":8,"disp":true,"width":"6","collapse":true},{"id":"250de740.57ee78","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
found here :
And Dashboard text node
-filter:v fps=fps=5
seems to be same or little better : the CPU is at 15% and respect 5fps. compared to -r 5
in the output.
BUT 1080p is allways unusable
This means you have no high FPS peak at startup anymore?
Looking for a needle in a haystack
- You can show some more logging via
ffmpeg -v verbose
, but I think we will need a shrink when evaluating the output of it ... But I could image that there are buffers being used, whose size is not sufficient for holding the data of large images. Or anything else ... - Some sites (e.g. zoneminder) advise to use TCP (instead of UDP) as transport protocol:
ffmpeg -rtsp_transport tcp ...
- In the previous Zoneminder link, they advise to lower the FPS in the camera itself (and use inside Zoneminder an FPS larger than the one from the camera').
And no, I always have the peak at startup:
There is a waiting time before the stream is displayed, (filling the buffer?) and when it has enough image, it launches them. Does it suddenly display the 30 images, to make up for the accumulated delay?Then the fps are respected.
If I set 5FPS per filter in the node, OR in the camera settings, I always have this peak at startup.
1080p 1FPS, poor quality, 190Kb/S. See at the right, the 720p camera parameters 5FPS, Best quality, 824Kb/s work like a charme !
1080p 1FPS, poor quality, 190Kb/S.
Even by reducing the parameters of the camera to 1FPS and "poor" quality (the bitrate is at 190Kb / s) I only have 1/8 of the image displayed by jerking and a rise to 7FPS displayed.
Surely the solution, but I admit being unable to do it.
I'm not an expert, but too me it seems that 'some' ffmpeg buffer is not big enough to fit the entire image. If you would add the verbose logging parameter (which I have showed in my previous post) we hopefully get a bit more information about what is going on.
Not quite sure what you mean. In my previous post I have explained which parameter you need to add to specify the tcp protocol.
Sorry Bart , I threw in the towel too early :
i test this : ffmpeg -v verbose -rtsp_transport tcp -i "rtsp://192.168.1.7:554/user=..
working with 720p, but unusable in 1080p
1080p, 1FPS, quality worst, TCP transport
[EDIT] i compare 1080p not working, with 720p working
1080p not working : 1
720p working :
1080p: 2
720p working :
1080p: 3
720p: 3
1080p: 4
720p: 4
1080p: 5
720p: 5
1080p: 6
1080p: 7
720p: 7
1080p 8
1080p 9
720p 9
1080p 10
720p 10
1080p 11
720p 11
1080p 12
720p 12
1080p 13
720p 13
1080p 14
720p 14
1080p 15
720p 15
I've made several test, but it remains this peak at startup