Teams over IP

So, with remote working and hybrid teaming currently upsetting the status-quo, there are some new technical challenges presenting themselves.

It was all so easy when people were in the office. They went into a meeting room equipped with a big screen, a decent PTZ webcam, and maybe an audio setup on the table. When they were all hiding at home from the (other) Big C it was also pretty easy: everybody had a webcam they begrudgingly enabled and meetings proceeded.

But what to do when things go hybrid? How do you facilitate all-hands meetings in an office when some proportion of staff are remote? Camera setups in all-hands situations get weird.

There are off-the-shelf solutions for this, but they are eye-wateringly expensive. Cameras (especially PTZ) run into the thousands, and they’re still pretty poor. And then… how to connect them?! USB? A dedicated machine? Where do we power it from, particularly in an open-plan office? Hmm.

It turns out there are some outstanding 4K cameras out there. They’re called security cameras. They are neat, unobtrusive and easily powered and connected with PoE over large distances that would make USB or HDMI sweat. Oh, and they cost under £200.

The catch? They aren’t webcams, and so all our favourite conferencing software doesn’t know how to use them.

There is of course off-the-shelf software for this. The options are typically Windows-bound, apparently of questionable quality and reliability, and costs at least hundreds of pounds in licenses. That’s an OK starting point, but can we do better? Is it really that hard to bridge an RTSP stream into Teams?

Nope!

So, here’s the four step plan to open-source success.

  1. Provision a Linux desktop machine (virtual or physical). All you need is RDP to be honest.
  2. Install V4L2 (Video 4 Linux) and FFmpeg.
  3. Configure however many virtual video devices you require.
  4. Run ffmpeg to stream each source (RTSP in this case) to each virtual video device.

Then just use those video devices as they are in Teams.

The commands?

# for Debian
sudo apt-get install v4l2loopback-dkms v4l2loopback-utils ffmpeg;
sudo modprobe v4l2loopback devices=2 video_nr=1,2 card_label="camera1","camera2";
sudo ffmpeg -re -rtsp_transport tcp -i rtsp://camera1:554/s0 -pix_fmt yuv420p -f v4l2 -vcodec rawvideo -vf scale=1280:720 /dev/video1 &
sudo ffmpeg -re -rtsp_transport tcp -i rtsp://camera2:554/s0 -pix_fmt yuv420p -f v4l2 -vcodec rawvideo -vf scale=1280:720 /dev/video2 &

If you’re wondering about the “-vf scale=1280:720”, that’s because (for Teams at least) it refuses to use the camera above that resolution. No, I don’t know why?!

The end result though: superb! RDP onto the machine to log into a Teams call (or any other provider that supports Linux or web-based calling) and enjoy seamless use of IP cameras as webcams.