BodyPix and OBS

Got BodyPix and OBS Studio Virtual Camera to work with minimum fuss. You'll need:

Getting things to run once installed

I used /dev/video10 for OBS and /dev/video11 for BodyPix. The important thing here is that OBS will enumerate the device in order when starting its Virtual Camera, therefor BodyPix needs to be last.

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback devices=2 \
  video_nr=10,11 \
  card_label="OBS Virtual Camera","BodyPix Camera" \
  exclusive_caps=1
python3 -m tf_bodypix replace-background \
  --source /dev/video0 \
  --output /dev/video11 \
  --background Documents/green.png

I recommend you wait a few seconds for TensorFlow-BodyPix to start streaming before starting OBS. Once in OBS you will find the BodyPix Camera in the list of availble V4L2 sources. In the example above I used a 16×9 pixels green PNG image as background; I then remove the background using the Chroma Key Filter on the V4L2 source inside OBS.

To stream locally (to Skype, Google Meet, …) use Start Virtual Camera (in the lower-right hand of the screen) then select the OBS Virtual Camera in the list of cameras.