There aren’t many 4k capable webcams around other than the Logitech BRIO which is also the most popular and the one I have used with the Jetson Xavier. Capable of 30 FPS at 4K resolution and with a price of about 200$ it is a cheap and rugged alternative to CSI-2 camera modules.
In order to run the webcam at 4K resolution you first need to make sure your Jetson is installed with a kernel version of at least 4.5 - the latest JetPack versions (4.2 for example) already have this requirement met. You also need to connect your BRIO with a USB 3.0 cable. USB 2.0 is not capable of transmitting 4K/30fps.
You will also need to install the v4l2-utils package in order to directly take control of your Logitech webcam. After installing the package you will be able to use the V4L2 TestBench to access your setting. The “Frame Size” option of resolutions above 1080p will only be accessible when the Capture Image Format is set to “MJPG (Motion-JPEG)”, which is the Logitech BRIO’s native output format.
Now to let OpenCV access the 4K capabilities of your Logitech BRIO webcam you need to set up the OpenCV VideoCapture class to use the MJPG Codec (remember: No MJPG - No 4K on the BRIO) as such:
cam = cv2.VideoCapture(DeviceNr) # /dev/video%DeviceNr cam.set(6, cv2.VideoWriterfourcc('M', 'J', 'P', 'G')) # setting MJPG codec cam.set(3, ResolutionX) # Width cam.set(4, ResolutionY) # Height
Hopefully this helped people that want to utilize resolutions higher than 1080p with their Jetsons. As of now I have only tested this on the Jetson Xavier Developer Kit. So far we are using a dual camera setup and are getting about 15fps out of both cameras in parallel use. If you know of any performance tweaks don’t hesitate to let me know.