Globotix / usb_cam

(ARCHIVED) A ROS Driver for V4L USB Cameras
http://wiki.ros.org/usb_cam
Other
0 stars 0 forks source link

Support for lower framerates for 1920x1080 or 1280x720 streams #2

Open LKSeng opened 2 years ago

LKSeng commented 2 years ago

As noted in #1, the framerate is pretty much stuck at 30fps (but set it as 31 in the frame_rate param) if one wants to use streams with resolutions higher than 640x480. It would be good to be able to publish at lower frame rate to reduce the network throughput when high framerates is not required.

LKSeng commented 2 years ago

I found that the same device that outputs in YUYV also outputs a MJPEG stream that goes up to 1920x1080 pixels in resolution. Use of this stream is enabled via the pixel_format = mjpeg_yuvj420p. The j is no typo: it (probably) stands for JPEG, which uses the full range for both Y and UV. This support was added in commit Globotix/usb_cam@17fe32e1d45d53ea94952e78e6e211f3e4c9fabb which allows for use of MJPEG stream, and is also less picky on (output) framerate.

The use of this stream allows users to go from 30fps to 15fps (1fps is possible, but the lag is >5s). Note that the max framerate is still what the device can output. Do consider using this format instead if possible if lower frame rate is desired (see #1).