How to reduce camera stream FPS or quality?

Any examples of how to reduce the FPS of a MJPEG camera stream? None of our camera’s supported MJPEG modes have a small enough bandwidth. I’m hoping for code I can plug into the camerastream example in java for the WPI PI vision image.

Just setting the camera’s configuration to a low FPS doesn’t actually adjust the true FPS, I assume because it’s not one of the camera’s available modes.

What camera, and what modes? You can always transcode, but that will take more CPU and increase latency.

Assuming you are using the cscore server, either on the Rio or a Pi, you can control the stream parameters with the URL you use. Shuffleboard does this for you. If you want to hand set the URL, you need to find the parameters. I know the the compression is “compression=”. So for example:
http://ipaddress:1181/stream.mjpg?compression=30

We have these cameras: https://www.amazon.com/dp/B00LQ854AG/ref=cm_sw_r_cp_ep_dp_d2qfzbF46W5CT

None of the MJPEG modes have a Mbps < 5

Right now we are using a Pi with the official WPI vision image on it. Is that the same as the cscore server?

It has been a while since I’ve used the MJPEG Streamer but if you look at the command your run to initialize it might have a Second flag to declare display FPS.

Yes. If you’re using Shuffleboard to view the stream, it has controls to set the FPS and quality. Also, the FRCVision 2019.2.1 version added the ability to set the default stream settings in the Vision Settings tab. Expand the camera, and edit the settings under “Video Stream Defaults” which has settings for FPS, Compression, and Default Compression.

1 Like