===== Creating a video loopback device (Linux) ===== * 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) ===== writing to loopback device with opencv Python ===== * import v4l2 * [[https://github.com/AlexJinlei/python-v4l2/issues/5|fix bug]] * the magic sauce is [[https://pypi.org/project/virtualvideo/|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 # ===== writing to loopback device with Pd/Gem ===== * ''|pix_record|'' is the magic sauce. Send it codec 33 and open file ''/dev/video[NUMBER]'' * {{ :lwc:multimedia_and_graphics:test1.pd |example}} ===== OpenCV (cv2) wiith Pycharm ==== 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''