Match a USB /dev/video1 with an alsa device

I have a few usb cameras that have a built in microphone.
I would like to save the correct audio stream in the correct video file.

how do i match an alsa hw:2,1 device with the correct /dev/video0 device ?

v4l2-ctl --list-devices
UVC Camera (046d:0825) (usb-70090000.xusb-2.3):
    /dev/video1

UVC Camera (046d:0825) (usb-70090000.xusb-2.4):
    /dev/video0
arecord --list-devices
**** List of CAPTURE Hardware Devices ****
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 0: ADMAIF1 CIF ADMAIF1-0 []
  Subdevices: 1/1
  ........
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 9: ADMAIF10 CIF ADMAIF10-9 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: U0x46d0x825_1 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

so one is hw:2,0 and the other hw:3,0 … but which way around ?

of coarse i can disconnect one, see which one is left and use that. but i need to be able to do this automatically.
any hints ?

Hi,
Not sure but it probably is enumerated in order. Since card 1 is a fixed audio device, it should be:

/dev/video0 -> card 2
/dev/video1 -> card 3
...

yeah maybe, but they can unplug and replug the usb device making it
/dev/video1
/dev/video2 ( the old /dev/video0)

at which stage the assumption will get me into trouble.
(ps: i realise this is not a nvidia related question, just thought someone here would have run into this before)

Hi,
Not sure if this helps but for your reference. There are also device nodes in /dev/v4l. For example, whiling connecting to Logitech Brio 4K USB camera, we can see

$ v4l2-ctl --list-formats-ext -d /dev/v4l/by-id/usb-046d_Logitech_BRIO_5DC4FB8E-video-index0

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