In this post, I would like to share the way I use Microsoft Teams on my Thinkpad x230 running FreeBSD 12.1, even with webcam support!
Note that I have bhyve with HD audio support on FreeBSD 12.1 (see this post for more information).
To start, you need a working webcam configured with webcamd(8), a Linux bhyve guest running in UEFI mode, my choice will be OpenSUSE 15.2, that I’m starting under bhyve using the following script.
VM=opensuse15.2 ifconfig tap0 up bhyve -AHP -s 0:0,hostbridge -s 1:0,lpc \ -s 2:0,virtio-net,tap0 -s 3:0,virtio-blk,./disk.img \ -c 2 -m 2048M \ -s 30,xhci,tablet \ -s 11,fbuf,tcp=0.0.0.0:5900,w=1280,h=1024,wait \ -s 6,hda,play=/dev/dsp0,rec=/dev/dsp0 \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ $VM bhyvectl --destroy --vm=$VM
The idea is to use the host webcam handled by webcamd through ssh to pass frames to the virtual machine. To do this, I have ssh running on FreeBSD and listening on IP 10.0.0.1, which is the IP of the bridge interface used by bhyve. OpenSUSE 15.2 is configured with a static IP 10.0.0.2 on tap0.
Passing webcam frames to the VM is not enough, we need to have a video4linux device that will feed Teams (or any other application) with the frames. Here comes into play v4l2loopback kernel module, that will do the job for us! Under OpenSUSE 15.2, it can be installed and loaded as follows
$ sudo zypper in v4l2loopback-kmp-default $ sudo modprobe v4l2loopback
The above will create a video device on /dev/video0, that we will be writing our frames to, the module loops them back for applications reading /dev/video0. Now we can start streaming video frames from our FreeBSD host webcam, and pipe them to /dev/video0 on OpenSUSE, using the following command.
#!/bin/sh ssh 10.0.0.1 "ffmpeg -r 14 -s 640x480 -f video4linux2 -i /dev/video0 -vcodec rawvideo -pix_fmt uyvy422 -f matroska -" | ffmpeg -i pipe: -f v4l2 /dev/video0
Now open Teams and you can use its audio/video call settings to test that audio and video are both working fine!