Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpicamera: support two CSI cameras at once (#1573) #1574

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

aler9
Copy link
Member

@aler9 aler9 commented Mar 15, 2023

Fixes #1573

@aler9 aler9 added the enhancement New feature or request label Mar 15, 2023
@aler9 aler9 force-pushed the feature-multiple-rpi-cameras branch from 09a61f4 to 00f5fec Compare March 15, 2023 10:02
@aler9
Copy link
Member Author

aler9 commented Mar 15, 2023

@marksutheran here is the nightly release, let me know if it works with two cameras:

rtsp-simple-server_v0.21.6-3-g00f5fec_linux_arm64v8.tar.gz
rtsp-simple-server_v0.21.6-3-g00f5fec_linux_armv6.tar.gz
rtsp-simple-server_v0.21.6-3-g00f5fec_linux_armv7.tar.gz

@codecov-commenter
Copy link

Codecov Report

Merging #1574 (00f5fec) into main (33b72c5) will increase coverage by 0.02%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #1574      +/-   ##
==========================================
+ Coverage   65.17%   65.19%   +0.02%     
==========================================
  Files          86       86              
  Lines        9410     9416       +6     
==========================================
+ Hits         6133     6139       +6     
  Misses       2829     2829              
  Partials      448      448              
Impacted Files Coverage Δ
internal/conf/path.go 21.80% <100.00%> (+0.84%) ⬆️
internal/core/core.go 84.37% <100.00%> (+0.11%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@marksutheran
Copy link

That was quick!

Quick test, running fine! And load is much reduced.

I will keep testing this out and play with higher frame rates etc

conf:

paths:
  cam0:
    source: rpiCamera
    rpiCameraCamID: 0
    rpiCameraWidth: 1920
    rpiCameraHeight: 1080
...
    rpiCameraFPS: 20
    rpiCameraIDRPeriod: 40
    rpiCameraBitrate: 4000000
    rpiCameraProfile: high
    rpiCameraLevel: '4.1'
...   
  cam1:
    source: rpiCamera
    rpiCameraCamID: 1
    rpiCameraWidth: 1920
    rpiCameraHeight: 1080
...

top:

top - 21:40:23 up  2:37,  3 users,  load average: 0.29, 0.28, 0.40
Tasks: 141 total,   1 running, 140 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.2 us,  3.4 sy,  0.0 ni, 92.3 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem :   7812.3 total,   7315.4 free,    208.1 used,    288.8 buff/cache
MiB Swap:    100.0 total,    100.0 free,      0.0 used.   7494.2 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                         
   1523 mark      20   0  730472  31880  14404 S  15.9   0.4   0:19.20 rtsp-simple-ser                                                                                                                                                                 
   1532 mark      20   0  350608  10900   9524 S   5.0   0.1   0:06.46 rtspss-embedded                                                                                                                                                                 
   1534 mark      20   0  350608  10872   9492 S   5.0   0.1   0:06.90 rtspss-embedded                                                                                                                                                                 
     72 root       0 -20       0      0      0 I   1.7   0.0   2:20.47 kworker/u9:0-brcmf_wq/mmc1:0001:1                                                                                                                                               
    783 root       0 -20       0      0      0 I   1.7   0.0   2:29.41 kworker/u9:2-brcmf_wq/mmc1:0001:1                                                                                                                                               
     93 root       1 -19       0      0      0 S   0.7   0.0   1:15.56 vchiq-slot/0                                                                                                                                                                    
   1474 mark      20   0   10080   3360   2616 S   0.7   0.0   0:02.58 top                                                                                                                                                                             
   1491 root      20   0       0      0      0 I   0.7   0.0   0:00.56 kworker/0:1-events                                                                                                                                                              
   1574 mark      20   0    9988   2944   2404 R   0.7   0.0   0:00.15 top

@marksutheran
Copy link

marksutheran commented Mar 15, 2023

FYI, continuing the quick test - without any special tuning the following configs work as follows and I suspect give an idea about the h/w encoding limits

Both cams 1920x1080 @ 20fps - stable streaming over WiFi for 2+ hours
Both cams 1080x720 @ 30fps - stable
One cams 1080x720 @ 30fps, one cam 1920x1080 @ 30fps - stable
Both cams 1920x1080 @ 25fps - unstable with the following error:
Both cams 1920x1080 @ 30fps - (more) unstable with the following error:

encoder_encode(): ioctl(VIDIOC_QBUF) failed
encoder_encode(): ioctl(VIDIOC_QBUF) failed
encoder_encode(): ioctl(VIDIOC_QBUF) failed

@marksutheran
Copy link

Both cams running continuous stream via WebRTC for 20 hours - no issues noticed.

@aler9 aler9 merged commit 32d6cb4 into main Mar 19, 2023
@aler9 aler9 deleted the feature-multiple-rpi-cameras branch March 19, 2023 23:22
@aler9
Copy link
Member Author

aler9 commented Apr 1, 2023

added in v0.22.0

@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple rpiCameras at once
3 participants