PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
264 stars 180 forks source link

Adjustment to streaming FPS #1232

Open rjbell4 opened 6 months ago

rjbell4 commented 6 months ago

Is your feature request related to a problem? Please describe. Network bandwidth for FRC matches is officially limited to 4 Mbps. When streaming the cameras (input or output), even reasonably decreasing the resolution can result in an bandwidth utilization over the maximum. This is especially true at higher framerates, where high FPS might be desirable for AprilTag detection, but not necessary to simply monitor the detection process.

Describe the solution you'd like Provide an option to lower the FPS for a camera's MJPEG stream (not only the resolution). Dropping from (for example) the 50 FPS used to actually analyze the camera data to 15 FPS would still be very useful for the drive team, but would reduce network bandwidth by 70%.

Describe alternatives you've considered Alternatively, streaming with an protocol that allows for partial frame updates, like H.264, could reduce bandwidth, but that's a lot more complicated, and more resource-intensive.

Additional context On a previous team years ago we took this approach of decoupling the FPS captured/analyzed from the FPS streamed, and we found it quite helpful.

mcm001 commented 6 months ago

I think creating a blocking FpsLimiterPipe in the stream output pipeline and exposing a fps limit prop as part of CVPipelineSettings is the easiest way to do this. Shouldn't be too hard.

srimanachanta commented 5 months ago

Doesn't the source object itself already have FPS-limited stuff? I know you can set FPS in shuffleboard and we use cscore for the MJPEG stream. Not sure if we have fully implemented all the features of that.