Anonymousdog / displaycameras

System for displaying RTSP feeds from IP cameras on the Raspberry Pi
Apache License 2.0
568 stars 114 forks source link

Can displaycameras handle a 4x4 matrix on 4k monitor with a pi4 #38

Closed shark92651 closed 2 years ago

shark92651 commented 4 years ago

I'm curious if anyone has been able to go as high as a 4x4 matrix of 16 camera feeds with a RPi4. I have a RPi4 4GB model on order and was hoping I could use it to eliminate a Windows NUC box that runs my current split-screen camera monitor.

RChadwick7 commented 4 years ago

I would be very curious to know the same thing.

Anonymousdog commented 4 years ago

You can try it. I know the 15 display limit seemed to have been a limit in omxplayer and not a resource exhaustion issue; so, I doubt it would work better on an RPi 4, but don't let me discourage you.

Andy

On Sat, Jan 18, 2020, 1:45 PM shark92651 notifications@github.com wrote:

I'm curious if anyone has been able to go as high as a 4x4 matrix of 16 camera feeds with a RPi4. I have a RPi4 4GB model on order and was hoping I could use it to eliminate a Windows NUC box that runs my current split-screen camera monitor.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Anonymousdog/displaycameras/issues/38?email_source=notifications&email_token=AHIYIKJXLQHSILZIJVWOIRTQ6NE55A5CNFSM4KIUQV52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IHD5I3Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIYIKPK3DNZ5QWPKEZMU23Q6NE55ANCNFSM4KIUQV5Q .

shark92651 commented 4 years ago

I finally got a chance to configure a RPi4 with 4GB and a 4K TV that I recently purchased. I am having no luck so far. Just trying to use 2 1920x1080 camera feeds I could only get one to display when I had gpu_mem set to 512. It would switch back and forth (like a flicker, but only displaying one feed at a time) between both feeds until ultimately one would go blank and then the 2nd would display fine. As ahjcheng mentioned in a closed post I read earlier, I then tried setting gpu_mem=1024 and I was able to get 2 1080p feeds to display, however an attempt to display 4 of them would only display the original 2. I then tried a lower res substream of 704x480. With this resolution I can only get 7 of 9 to display when trying a 3x3 layout. I'm not sure if this is just poor support for 4k displays in the RPi4, an issue with my 4K TV, or what.

https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md The documentation linked above states: Values of gpu_mem over 512 are not recommended, will provide no performance improvements, and are untested.

Something did change when I set it to 1024, in that it would allow 2 1080p streams where when I set it to 512 it would flash back and forth between the 2. In the end, it is very inconsistent and I can't figure out any combination of settings that will allow me to display more than 2 streams at 1080p or more than 7 at D1 (704x480).

shark92651 commented 4 years ago

I did some more testing this morning. When changing the gpu_mem to 512 or less, the system will display all 9 feeds in a 3x3 matrix, but has the super-seizure flashing issue. If I up the gpu_mem to 944 or 1024, there is no flashing but will only display 7 feeds. Any suggestions on settings I should try to resolve the issue?

These are the display related settings that are uncommented in config.txt: hdmi_group=1 hdmi_mode=95 config_hdmi_boost=6 dtoverlay=vc4-fkms-v3d max_framebuffers=2 gpu_mem=944

More Info: If I switch from the 4K 30hz to 60hz (hdmi_enable_4kp60=1 and hdmi_mode=97) then the number of feeds displayed drops down from 7 to 5. I also tried setting max_framebuffers=1 since I am using a single monitor but that had no effect. There definitely seems to be some issue with the 4k monitor support in the RPi4.

TLovskog commented 4 years ago

I have the exact same problem with 2560x1440. With 512 gpu_mem all streams (10) show up, but with some serious flickering. With higher gpu_mem omxplayer fails to start playback of stream 8 and above. I accidentally run omxplayer with one of the failing streams, to test. Then I started the displaycameras. Now only 6 streams appear and after that opmxplayer fails on all remaining.

... cut successful stream 1-6 Starting omxplayer for Garage Garage started Starting omxplayer for LivingRoom Waiting for LivingRoom omxplayer startup 0 Waiting for LivingRoom omxplayer startup 1 Waiting for LivingRoom omxplayer startup 2 Waiting for LivingRoom omxplayer startup 3 Waiting for LivingRoom omxplayer startup 4 Waiting for LivingRoom omxplayer startup 5 Waiting for LivingRoom omxplayer startup 6 Waiting for LivingRoom omxplayer startup 7 Waiting for LivingRoom omxplayer startup 8 Waiting for LivingRoom omxplayer startup 9 Waiting for LivingRoom omxplayer startup 10 LivingRoom failed playback ... cut

shark92651 commented 4 years ago

I believe the issue is either with Omxplayer or with the RPi4 support for 4k monitors. I tried a different solution that uses Omxplayer and it behaved exactly the same - can only get 8 streams to work.

TLovskog commented 4 years ago

If I edit the displaycameras script to omit any start of omxplayer between 1-7, number 8 will start. Seams to be something with starting more than 7 omxplayer instances.

Anonymousdog commented 4 years ago

You can run up to 15 instances, just not at those resolutions.

On Mon, Feb 17, 2020 at 5:03 PM Thomas Lövskog notifications@github.com wrote:

If I edit the displaycameras script to omit any start of omxplayer between 1-6, number 7 will start. Seams to be something with starting more than 6 omxplayer instances.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Anonymousdog/displaycameras/issues/38?email_source=notifications&email_token=AHIYIKKJSW5L6C4O2C7CAM3RDMCSRA5CNFSM4KIUQV52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL7YXAY#issuecomment-587172739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIYIKNMZYTUSEDI64MO4KDRDMCSRANCNFSM4KIUQV5Q .

TLovskog commented 4 years ago

Thanks for responding. Resolutions as in my total 2560x1440 or resolutions on my streams 640x360 x 10

rws832 commented 4 years ago

Do you have the code for the 4x4 layout for a 1920x1080 screen? I am trying to get 13 cameras on one screen.

shark92651 commented 4 years ago

I have a code generator that can create it. Here it is assuming you want to divide the screen evenly between 16 windows in 4x4 matrix. Obviously you need to tweak your user/pass and rtsp stream URLs. Also keep in mind that if the Pi has to downscale your actual feed resolutions to fit the window sizes it will impact performance.

layout.txt

Anonymousdog commented 4 years ago

The aggregate of the streams, especially if there is ANY downscaling.

Andy

On Mon, Feb 17, 2020 at 5:08 PM Thomas Lövskog notifications@github.com wrote:

Thanks for responding. Resolutions as in my total 2560x1440 or resolutions on my streams 640x460 x 10

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Anonymousdog/displaycameras/issues/38?email_source=notifications&email_token=AHIYIKKDR63EARP3CQHMLKLRDMDFTA5CNFSM4KIUQV52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL7ZAOY#issuecomment-587173947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIYIKJ23PSF5OIH7B3KCR3RDMDFTANCNFSM4KIUQV5Q .

rws832 commented 4 years ago

Thanks for the code. Where can I find this code generator at also? We have several displays to convert over to the displaycameras an it would come in handy.

shark92651 commented 4 years ago

It's a simple C++ app I wrote in Visual Studio. Here is the main code. You just need to add a simple UI or adapt it into a console app. You need to input 4 integers:

seCols.Value and seRows.Value is the size of the matrix (4x4 for example) seW.Value and seH.Value is the window width and height of the feeds meResults.Lines is the UI control that receives the output, or you could dump it to a file.

Form1.txt

rws832 commented 4 years ago

Thanks Shark92651. This will save a lot of time.

SvenVD commented 4 years ago

just FYI, https://github.com/SvenVD/rpisurv has integrated autocalculation of the windows. Downside is that currently all streams are handled the same, so you can not make one stream bigger as another, but this covers must use cases like a 4x4.

shark92651 commented 4 years ago

That's good to know. I would give rpisurv a try but I fear it also won't handle 9 streams on RPi4 and 4K monitor since it also uses omxplayer. I have tried two different packages, both based on omxplayer, and both fail to handle 9 streams at 704x480 on 4K monitor.