match audio with video

clogwog

New Member
Joined
Oct 25, 2021
Messages
1
Reaction score
0
Credits
15
I have some usb cameras that have also a microphone onboard.
I would like to find the card/device ( for an alsa hw adddress) with the right camera automatically (once i know how to link them)

Code:
ls /dev/video*
/dev/video0
/dev/video1

Code:
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

Code:
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 this tells me that one of the usb cameras has an alsa hw address of hw:2,0 and the other one hw:3,0
but how do i match it to the correct /dev/video0 and /dev/video1 ?

some other things i've tried to see if i can match them :


Code:
/dev/snd/by-path$ ls -la
total 0
drwxr-xr-x 2 root root 120 Oct 25 20:54 .
drwxr-xr-x 4 root root 640 Oct 25 20:54 ..
lrwxrwxrwx 1 root root  12 Jan 29  2018 platform-70030000.hda -> ../controlC0
lrwxrwxrwx 1 root root  12 Oct 25 20:54 platform-70090000.xusb-usb-0:2.3:1.2 -> ../controlC3
lrwxrwxrwx 1 root root  12 Oct 25 20:36 platform-70090000.xusb-usb-0:2.4:1.2 -> ../controlC2
lrwxrwxrwx 1 root root  12 Jan 29  2018 platform-sound -> ../controlC1

and
Code:
ls -la /dev/v4l/by-path/
total 0
drwxr-xr-x 2 root root 80 Oct 25 20:54 .
drwxr-xr-x 4 root root 80 Oct 25 20:36 ..
lrwxrwxrwx 1 root root 12 Oct 25 20:54 platform-70090000.xusb-usb-0:2.3:1.0-video-index0 -> ../../video1
lrwxrwxrwx 1 root root 12 Oct 25 20:36 platform-70090000.xusb-usb-0:2.4:1.0-video-index0 -> ../../video0
so that looks promissing as xusb-usb-0:2.3:1 shows up in both, but then i still don't know which sound card ./controlC3 is.....

and

Code:
[email protected]:/dev/snd$ udevadm info /dev/snd/controlC2
P: /devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.2/sound/card2/controlC2
N: snd/controlC2
S: snd/by-id/usb-046d_0825_2821F020-02
S: snd/by-path/platform-70090000.xusb-usb-0:2.4:1.2
E: DEVLINKS=/dev/snd/by-id/usb-046d_0825_2821F020-02 /dev/snd/by-path/platform-70090000.xusb-usb-0:2.4:1.2
E: DEVNAME=/dev/snd/controlC2
E: DEVPATH=/devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.2/sound/card2/controlC2
E: ID_BUS=usb
E: ID_MODEL=0825
E: ID_MODEL_ENC=0825
E: ID_MODEL_ID=0825
E: ID_PATH=platform-70090000.xusb-usb-0:2.4:1.2
E: ID_PATH_TAG=platform-70090000_xusb-usb-0_2_4_1_2
E: ID_REVISION=0012
E: ID_SERIAL=046d_0825_2821F020
E: ID_SERIAL_SHORT=2821F020
E: ID_TYPE=audio
E: ID_USB_DRIVER=snd-usb-audio
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=02
E: ID_VENDOR=046d
E: ID_VENDOR_ENC=046d
E: ID_VENDOR_ID=046d
E: MAJOR=116
E: MINOR=25
E: SUBSYSTEM=sound
E: TAGS=:uaccess:
E: USEC_INITIALIZED=4072323644
E: net.ifnames=0




$ udevadm info /dev/snd/controlC3
P: /devices/70090000.xusb/usb1/1-2/1-2.3/1-2.3:1.2/sound/card3/controlC3
N: snd/controlC3
S: snd/by-id/usb-046d_0825_1A0D6A40-02
S: snd/by-path/platform-70090000.xusb-usb-0:2.3:1.2
E: DEVLINKS=/dev/snd/by-path/platform-70090000.xusb-usb-0:2.3:1.2 /dev/snd/by-id/usb-046d_0825_1A0D6A40-02
E: DEVNAME=/dev/snd/controlC3
E: DEVPATH=/devices/70090000.xusb/usb1/1-2/1-2.3/1-2.3:1.2/sound/card3/controlC3
E: ID_BUS=usb
E: ID_MODEL=0825
E: ID_MODEL_ENC=0825
E: ID_MODEL_ID=0825
E: ID_PATH=platform-70090000.xusb-usb-0:2.3:1.2
E: ID_PATH_TAG=platform-70090000_xusb-usb-0_2_3_1_2
E: ID_REVISION=0012
E: ID_SERIAL=046d_0825_1A0D6A40
E: ID_SERIAL_SHORT=1A0D6A40
E: ID_TYPE=audio
E: ID_USB_DRIVER=snd-usb-audio
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=02
E: ID_VENDOR=046d
E: ID_VENDOR_ENC=046d
E: ID_VENDOR_ID=046d
E: MAJOR=116
E: MINOR=27
E: SUBSYSTEM=sound
E: TAGS=:uaccess:
E: USEC_INITIALIZED=5134507504
E: net.ifnames=0

and

Code:
 udevadm info /dev/video0
P: /devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.0/video4linux/video0
N: video0
S: v4l/by-id/usb-046d_0825_2821F020-video-index0
S: v4l/by-path/platform-70090000.xusb-usb-0:2.4:1.0-video-index0
E: COLORD_DEVICE=1
E: COLORD_KIND=camera
E: DEVLINKS=/dev/v4l/by-path/platform-70090000.xusb-usb-0:2.4:1.0-video-index0 /dev/v4l/by-id/usb-046d_0825_2821F020-video-index0
E: DEVNAME=/dev/video0
E: DEVPATH=/devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.0/video4linux/video0
E: ID_BUS=usb
E: ID_FOR_SEAT=video4linux-platform-70090000_xusb-usb-0_2_4_1_0
E: ID_MODEL=0825
E: ID_MODEL_ENC=0825
E: ID_MODEL_ID=0825
E: ID_PATH=platform-70090000.xusb-usb-0:2.4:1.0
E: ID_PATH_TAG=platform-70090000_xusb-usb-0_2_4_1_0
E: ID_REVISION=0012
E: ID_SERIAL=046d_0825_2821F020
E: ID_SERIAL_SHORT=2821F020
E: ID_TYPE=video
E: ID_USB_DRIVER=uvcvideo
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=00
E: ID_V4L_CAPABILITIES=:capture:
E: ID_V4L_PRODUCT=UVC Camera (046d:0825)
E: ID_V4L_VERSION=2
E: ID_VENDOR=046d
E: ID_VENDOR_ENC=046d
E: ID_VENDOR_ID=046d
E: MAJOR=81
E: MINOR=0
E: SUBSYSTEM=video4linux
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=4072324257
E: net.ifnames=0

so i can match them on ID_USB_INTERFACES, but then still don't know the alsa hw address..

any other tricks out there ?
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top