Notes for streaming conferences

$ sudo rtl_fm -f 591.8M -l 1 -M wbfm | ffmpeg -f s16le -ar 32k -ac 1 -i - test.mp3

capture the room mic at UOttawa. Still needs tuning since it's not locking onto the frequency right and needs some clip proctection

db's capture of 1140 during Kris's pkgbase talk: dev_1140.mp3

Definitely need some filtering to get the radio noise out. You can't hear the audience, unlike the webcam so that will be a problem.

Capture cards

Webcams and capture devices behave about the same. Use ffmpeg -f v4l2 -list_sources all -i /dev/video0 to list the options that the device will output. Pulling a stream from the device will be a line like ffmpeg -f v4l2 -c:v mjpeg -s 1280x720 -i /dev/video0 ....

webcamd seems to only support up to UVC 1.1 based on:

USB Video Class driver (1.1.1)

This means things like the Brio (1.5) are out. The other webcams I have are all 1.0 and USB2, and they work fine. The elgato camlink is UVC 1.1, and gets detected by webcamd, but after starting, webcamd just sits there eating cpu and ffmpeg never gets a stream

The EZCAP cards report UVC 1.0 when plugged into a USB2 port, and never get a stream. When plugged into a USB 3 port, it shows ups as cfg=255 and webcamd will not start

USB2 port:

ugen1.3: <VXIS Inc ezcap U3 capture> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
$ sudo webcamd -d 1.3
USB Video Class driver (1.1.1)
cpia2: V4L-Driver for Vision CPiA2 based cameras v3.0.1
USBVision USB Video Device Driver for Linux : 0.9.11
Attached to ugen1.3[0]
uvcvideo: Found UVC 1.00 device ezcap U3 capture (1bcf:2c99)
Creating /dev/video0
Creating /dev/video1

USB3 port

ugen0.5: <VXIS Inc ezcap U3 capture> at usbus0, cfg=255 md=HOST spd=SUPER (5.0Gbps) pwr=ON (100mA)
$ sudo webcamd -d 0.5
USB Video Class driver (1.1.1)
cpia2: V4L-Driver for Vision CPiA2 based cameras v3.0.1
USBVision USB Video Device Driver for Linux : 0.9.11
webcamd: Cannot find USB device

usbconfig

$ sudo usbconfig -d 0.3 dump_all_desc
ugen0.3: <VXIS Inc FHD Webcamera> at usbus0, cfg=255 md=HOST spd=SUPER (5.0Gbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0310
  bDeviceClass = 0x00ef  <Miscellaneous device> 
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0009
  idVendor = 0x1bcf
  idProduct = 0x2c99
  bcdDevice = 0x0200
  iManufacturer = 0x0001  <VXIS Inc>
  iProduct = 0x0002  <FHD Webcamera>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

The problem seems to be config setting

May 20 20:26:25 StreamNUC kernel: usb_alloc_device: Failure selecting configuration index 0:USB_ERR_IOERROR, port 13, addr 4 (ignored)
May 20 20:26:25 StreamNUC kernel: ugen0.5: <VXIS Inc FHD Webcamera> at usbus0

And the result of usbdump while plugging the card in:

19:30:54.619707 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:30:54.730265 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=20,IVAL=0,ERR=0
19:30:54.767885 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.384659 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=4,IVAL=0,ERR=0
19:31:06.417197 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.488519 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=4,IVAL=0,ERR=0
19:31:06.521131 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.592435 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=4,IVAL=0,ERR=0
19:31:06.624960 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.696278 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=20,IVAL=0,ERR=0
19:31:06.728765 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.814238 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=4,IVAL=0,ERR=0
19:31:06.846905 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:06.918096 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=28,IVAL=0,ERR=0
19:31:06.950676 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:07.022094 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=12,IVAL=0,ERR=0
19:31:07.047026 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:07.096353 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:07.121133 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:07.173034 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:07.471982 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:07.521240 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:07.546019 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:07.597852 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:07.904533 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:07.953653 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:07.978454 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:08.030446 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:08.336550 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:08.385684 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:08.410496 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:08.462422 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:08.911907 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:09.022665 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=20,IVAL=0,ERR=0
19:31:09.062870 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:09.173420 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=12,IVAL=0,ERR=0
19:31:09.198226 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:09.247322 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:09.272130 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:09.324063 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:09.630706 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:09.679864 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:09.704702 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:09.756611 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:10.063392 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:10.112516 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:10.137314 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:10.189244 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
19:31:10.487202 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=8,IVAL=0
19:31:10.536326 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=1024,IVAL=0,ERR=0
19:31:10.561289 usbus0.3 SUBM-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0
19:31:10.613143 usbus0.3 DONE-CTRL-EP=00000080,SPD=SUPER,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR

Debugging:

Turning on USB debugging. In loader.conf set:

hw.usb.ehci.lostintrbug=1
hw.usb.ehci.iaadbug=1
hw.usb.ehci.debug=1
hw.usb.xhci.debug=1

The cfg=255 from usbconfig indicates that the device was not initialized correctly. This is due to the error from above: usb_alloc_device: Failure selecting configuration index 0:USB_ERR_IOERROR The usb device could not set its configuration, in this case due to some error. We can try a few things. One is to set the configuration manually, but that didn't work unsurprisingly. usbconfig -d 0.3 set_config 1 gave errors like May 21 19:02:33 StreamNUC kernel: xhci_check_transfer: TD has I/O error

Attempt to ignore errors from USB devices

Since the cheaper UVC 1.0 capture cards are erroring and being left unconfigured, maybe if we continue a little harder they'll work anyways, since they work fine in windows. Tring the following patch based on some ML posts by hps.

Index: sys/dev/usb/usb_device.c
===================================================================
--- sys/dev/usb/usb_device.c	(revision 348001)
+++ sys/dev/usb/usb_device.c	(working copy)
@@ -2009,6 +2009,8 @@
 			    "%s, port %u, addr %u (ignored)\n",
 			    config_index, usbd_errstr(err), udev->port_no,
 			    udev->address);
+			err = 0;
+			goto config_done;
 		}
 		/*
 		 * Some USB devices do not have any configurations. Ignore any