Skip to content

"No v4l2 loopback device found" after using pyvirtualcam once with exclusive_caps=1 #61

@MasinAD

Description

@MasinAD
  • Operating system: Arch Linux
  • pyvirtualcam version: 0.8.0
  • Virtual camera (OBS, v4l2loopback, UnityCapture): v4l2loopback
  • Virtual camera version: 0.12.5-1

Describe the bug
After running a script using pyvirtualcam the next run causes this error:

RuntimeError: 'v4l2loopback' backend: No v4l2 loopback device found at /dev/video[0-99]. Did you run 'modprobe v4l2loopback'? See also pyvirtualcam's documentation.

Only after unloading and reloading the kernel module I can run another script using pyvirtualcam.

To Reproduce
Every single sample code causes this error.

#!/usr/bin/env python3
import pyvirtualcam
import numpy as np

with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam:
    print(f'Using virtual camera: {cam.device}')
    frame = np.zeros((cam.height, cam.width, 3), np.uint8)  # RGB
    while True:
        frame[:] = cam.frames_sent % 255  # grayscale animation
        cam.send(frame)
        cam.sleep_until_next_frame()

I even rewrote a script to not use the with statement and call cam.close() (and even cam._backend.close()) directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LinuxThis issue appears on Linuxhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions