Using a raspberry pi as a webcam

Preconditions

Steps

  1. sudo modprobe v4l2loopback
  2. nc -lp $PORT | ffmpeg -i pipe: -f h264 -r 30 -f v4l2 /dev/video0
  3. send the data back to the host ssh RASPI -c raspivid -o tcp://$HOST:$PORT -t 0
  4. use as a webcam or test the view with mpv "av://v4l2:/dev/video0"