Max multiple stream limit?

Hi,
im using the schedule player, single playlist showing a 3 x 3 streams for my cctv
i can add 8 streams without any issues or problems,
but the minute i set the 9th stream, the unit freaks out and flashs green all over the screen,
images are warped and not right at all!
but if i remove the 9th stream and put it back to only 8 streams it works no problems
is this a limitation of streams?
i am only using a Pi 2B with a resolution of 1280x1024 60.00Hz
i know the screen resolution doesnt device by 3 correctly but thats ok
is it maybe my Pi is underpowered?
Regards
Simon

I think the limitation is more with regards to placing videos on the screen. The way this works on the Pi is that the video decoder decodes each video into a pixel buffer (essentially a memory area holding color values of the decoded video frame). When combining the output to send it to the HDMI port, a “Hardware Video Scaler (HVS)” takes all those memory regions and picks pixels from each of them according to the arrangement made by your setup.

In your case for 8 videos, there’s a total of 9 such pixel buffers as one is created by info-beamer itself for rendering images. I’m not entirely sure what the limitations on the number of pixel buffers is, but each additional one requires more processing by the HVS. Adding a tenth pixel buffer might be too much, although the limit might not be fixed but might also depend on how those pixel buffers are placed. For example putting a 320x200 pixel buffer into a 320x200 area on the screens is lower on resources than placing it into one with a non-matching size forcing the HVS to down/upscale.

Similarly I’m not entirely sure if there is a limit on the number of concurrent video decoders. Maybe the limit is 8 and when using 9, they start to corrupt each other? I don’t think any of those limits is properly documented anywhere.

im going to do some more testing when i get chance this week,
as im sure in the past i remember running 16 camera streams on a pi at one point with no issues
but i think i might of been using a pi 3 and a HDMI monitor 1080p
rather than a pi 2 with a hdmi to dvi lead and a square monitor with square resolution

The relevant hardware for HVS and video decoding is the same on both versions maybe clocked slightly faster. So I would be somewhat surprised if that makes a big difference.

strange one to ask
the streams are actually 352 x 288
but ive set the size of the stream on the player as 426 x 341
could this be a factor?
the fact its upscaling the stream to fit the size ive set in the playlist?
can i tell the playlist to use the bigger size but just show the smaller size stream inside it?
i dont mind black spacing around the images

That’s definitely a factor. If you run vcgencmd dispmanx_list on the pre-Pi4 device you get a list of active layers, each having a cost value. I’m not entirely sure how that’s calculated and if there’s a global cost budget you should not exceed, but upscaling and transparency do increase that value.

It’s somewhat intuitive when you think about it: If you upscale, each pixel in your output is potentially a combination of four pixels of the source pixel buffer. Remember the rainbow screen shown when a non-info-beamer Pi starts? That’s actually just a 2x2 pixel buffer containing a red, yellow, blue and cyan pixel. When it’s scaled up to fill the complete screen, each pixel sent to the display is a mix of those four color values depending on the position. That’s ok for a single layer like that, but each additional one adds more load to the HVS.

As you use the scheduled player, use the input fields to set the video render size to its actual size, so it’s 1:1.

this is the output from the pi with 8 cameras

info-beamer-1190125987 /space/root # vcgencmd dispmanx_list
display:2 format:RGBA32 transform:20000 layer:10 1280x1024 src:0,0,1280,1024 dst:0,0,1280,1024 cost:801 lbm:0
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,0,426,341 cost:386 lbm:6144

below is the output from 9 cameras

info-beamer-1190125987 /space/root # vcgencmd dispmanx_list
display:2 format:RGBA32 transform:20000 layer:10 1280x1024 src:0,0,1280,1024 dst:0,0,1280,1024 cost:801 lbm:0
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,0,426,341 cost:386 lbm:6144

any suggestions?

EDIT: also the 2nd image isnt always like that, sometimes the green-ness is over other cameras or all over the screen or flashing here there n everywhere

ok amazingly, setting the streams to the size of the feeds works!
just need to sort out the positioning of them now!
also one stream i wanted to add to the monitor
is on our NVR unit rather than our DVR, so it uses a different size for the stream again!
more trial and error playing with i now guess!

EDIT:
all positioned and even added in the NVR camera which has a different size stream
but told the playlist to just set the size of it to same as others!

Nice. Out of curiosity, what does the dispmanx_list output look like now?

9 streams,
8 set same size as the streams,
1 set to same size of other streams but the stream size is LARGER than the size

info-beamer-1190125987 /space/root # vcgencmd dispmanx_list
display:2 format:RGBA32 transform:20000 layer:10 1280x1024 src:0,0,1280,1024 dst:0,0,1280,1024 cost:801 lbm:0
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:56,368,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:464,368,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:872,368,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:464,40,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:56,696,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:464,696,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:872,40,352,288 cost:345 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 704x576 src:0,0,704,576 dst:872,696,352,288 cost:932 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:56,40,352,288 cost:345 lbm:6144

so after i setup a pi 3 this morning, running version 240713-383103 stable-0014
it is displaying all the streams correctly on the screen, but the preview/screenshot in the web ui of the screen shows all the greenness and misplaced cameras etc
(abit stuttery too when watching the display but that might just be because im port forwarding as my dvr is at home and the pi is in my office)

info-beamer-4175594308 /space/root # vcgencmd dispmanx_list
display:2 format:RGBA32 transform:20000 layer:10 1280x1024 src:0,0,1280,1024 dst:0,0,1280,1024 cost:801 lbm:0
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,0,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:852,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,341,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:426,682,426,341 cost:386 lbm:6144
display:2 format:YUV_UV transform:0 layer:15 352x288 src:0,0,352,288 dst:0,0,426,341 cost:386 lbm:6144

Generating the preview doubles the load of the HVS, as it now not only has to render the content via HDMI but also to the screenshot pixel buffer. So unfortunately that’s expected if you already run the system at the limit.

ah right ok that makes sense!
so in theory its trying to capture 18 streams at once even tho its only 9,
i have a pi 4 2gb, so ill try that when i get chance and see if it helps!
would adjusting the gpu memory help do you think?

The Pi4 works completely different in that regard. Instead of dispmanx it now uses the standard Linux KMS/DRM API for handling display composition. There’s a hard limit of IIRC 20 layers total, but if you use more than 10, you won’t be able to properly create screenshots as again they are used while creating those too.