Switching Streams with Limelight and USB Camera

I am looking to send a single feed to Shuffleboard that switches between a USB Camera and a limelight video feed. (I’m using the limelight USB port in addition to a separate usb camera connected to the rio) Using the CameraServer switchedcamera method and an HTTP server I have been able to create a stream to send to shuffleboard but the limelight feed seems to always be streaming to the DS, limiting bandwidth and negating the point of switching the streams. [Here is the main part of my implementation: https://gist.github.com/alexanderswerdlow/842c86bb2e59976cf321453964d71d6c]

I haven’t been able to separate the Limelight feed from the USB port feed, from what I’ve tried the two are stitched together and sent as the same video. Any help would be appreciated

If you’re using a second usb camera, you can change between three streaming modes on limelight. Modes 1 and 2 are ‘320x240’ while mode 0 (the default) is double width as you describe.

Just set the ‘stream’ value in the network table to one of these settings:
0 = both streams stitched together into one image
1 = built-in camera with thumbnail of the usb camera
2 = usb camera with thumbnail of the built-in camera

The limelight doesn’t stream anything unless something is connected to its stream. Sometimes I’ve seen chrome (and maybe other web browsers) hold a connection to the stream even after you close the tab. Then if you open a new tab to your limelight you actually have two copies of the stream! I believe this is a caching strategy they use to make web pages appear to load faster. Anyway, if nothing is reading the stream, no bandwidth is used.

1 Like

How do you select between streams? We connected a USB camera but do not see the side-by-side default.


Did you attach your usb camera before booting? This is a necessary step.

No - we attached it after booting - thanks!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.