allo- / virtual_webcam_background

Use a virtual webcam background and overlays with body-pix and v4l2loopback
GNU General Public License v3.0
306 stars 48 forks source link

Close script and restore camera #74

Closed gmalfatti closed 3 years ago

gmalfatti commented 3 years ago

Hi, first of all thank you, the program works great!!! Is there a way to close the program correctly? When I do ctrl+< or ctrl+c, it closes but the webcam remains captured, so I cannot use neither the virtual (obviously cause it's close) nor the original camera. The only option I found is restarting, but that seems a lot. Thank you in advance!

allo- commented 3 years ago

Ctrl-C should work. You should also be able to start the script again and most programs should continue using the virtual device without any problems (They usually show the last frame while the script is stopped and continue with the first of the new instance).

The other side is the program that is capturing the virtual device for reading when you use exclusive_caps (as needed at least for chromium-based browsers). Here you need to make sure the program, e.g., chromium releases the webcam device. Closing the tab that is using the webcam should usually be sufficient for this.

You can debug the issue using lsof and fuser commands to see which programs are still accessing the device node.

Another option is using akvcam instead of v4l2loopback. akvcam provides a continuous video stream with fallback to an image or test pattern and can be configured to work with the script. See the comments in #33.

gmalfatti commented 3 years ago

Thank you very much... it turns out MS Teams got the device abducted. Thanks for the quick response!!! :)