Writing to disk from 2 USB camera streams at the same time

Can someone please share info/repos/tutorials/sample code/etc to help me get 2 USB cameras working at the same time on my Jetson Nano? Code would be ideal! I got 1 cam working using opencv-python, but was not able to work out 2 cams using multithreading. And I am not able to use CSI cams at the moment.

I have been digging through forum posts for a very focused last couple hours and have come across nothing too significant.

Here, user WiSi-Testpilot shows off his setup for 2 cams and provides a CL command for 1 cam

This js repo apparently provides an api for streaming from 2 USB cams to a browser.

hello AmateurPirate,

may I know what’s your actual use-case,
please refer to Camera Architecture Stack.
since [Camera Core] did not support USB camera inputs, you may enable the stream by v4l2 standard controls or v4l2src plugin.
please refer to below commands to dump USB frames, you should also duplicate that commands for your 2nd USB camera.
for example,

$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=MJPG --stream-mmap --stream-count=1 --stream-to=usb0.mjpg

or

$ gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)800, framerate=(fraction)30/1" ! nvvidconv ! nvjpegenc ! filesink location=cam0.jpg

Hi Jerry,

I’m trying to do 3D mapping of movements of a mouse. So I’m trying to use the Jetson Nano to get synched videos of 2 perspectives of the mouse. I might get the Nano to manipulate some stepper and servo motors and do inference with a tf model, but I’ll deal with those after I get the cams working. Ideally I need to get somewhere in the neighborhood of 400*400 pixels and ~100fps from each cam.

Thanks so much for the quick response and I’ll read through the page that you sent me now!

hello AmateurPirate,

you may also check [Jetson Linux Multimedia API Reference], please refer to Multimedia API Sample Applications.
there’s 12_camera_v4l2_cuda example to demonstrates how to capture images from a V4L2 YUV type of camera and share the image stream with CUDA.
thanks