lwc:multimedia_and_graphics:realtime

  • v4l2loopback works in ubuntu 20.04 but the binary needs to be compiled:
    • get the headers for the kernel version you are using
    • from the package manager install v4l2loopback-source
    • cd /usr/src/v4l2loopback-0.12.3/
    • sudo make
  • sudo modprobe v4l2loopback
  • to create 2 devices modprobe v4l2loopback devices=2 (untested but in the docs)
  • import v4l2
  • the magic sauce is virtualvideo. Trying to convert/write raw video seemed like a dead end:
    • import virtualvideo
    • in the example code: fvd.init_output(2, 1280, 720, fps=30) the first parameter (2) is the video #
  • |pix_record| is the magic sauce. Send it codec 33 and open file /dev/video[NUMBER]

For code completion to work you need to downgrade openCV :(

  • from the terminal inside Pycharm: pip install --force-reinstall --no-cache -U opencv-python==4.5.5.62
  • lwc/multimedia_and_graphics/realtime.txt
  • Last modified: 2022/11/27 12:23
  • by John Harrison