Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch program - "Invalid argument" error #170

Open
d3-X-t3r opened this issue Oct 22, 2021 · 16 comments
Open

Unable to launch program - "Invalid argument" error #170

d3-X-t3r opened this issue Oct 22, 2021 · 16 comments

Comments

@d3-X-t3r
Copy link

I'm unable to run this program, compiled directly from the latest git clone without any errors.

$ python3 fake.py

INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Real camera original values are set as: 640x480 with 30 FPS and video codec 1448695129
Real camera new values are set as: 1280x720 with 30 FPS and video codec 1196444237
Traceback (most recent call last):
  File "/home/dexter/Downloads/Linux-Fake-Background-Webcam/fake.py", line 494, in <module>
    main()
  File "/home/dexter/Downloads/Linux-Fake-Background-Webcam/fake.py", line 483, in main
    cam = FakeCam(args)
  File "/home/dexter/Downloads/Linux-Fake-Background-Webcam/fake.py", line 120, in __init__
    self.fake_cam = pyfakewebcam.FakeWebcam(self.v4l2loopback_path, self.width,
  File "/home/dexter/.local/lib/python3.9/site-packages/pyfakewebcam/pyfakewebcam.py", line 54, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument

OS: Arch Linux x64
python3 version: 3.9.7
pip3 version: pip 21.3

$ v4l2-ctl -D 

Driver Info:
	Driver name      : uvcvideo
	Card type        : HP HD Camera: HP HD Camera
	Bus info         : usb-0000:00:14.0-9
	Driver version   : 5.14.14
	Capabilities     : 0x84a00001
		Video Capture
		Metadata Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : uvcvideo
	Model            : HP HD Camera: HP HD Camera
	Serial           : 01.00.00
	Bus info         : usb-0000:00:14.0-9
	Media version    : 5.14.14
	Hardware revision: 0x00000006 (6)
	Driver version   : 5.14.14
Interface Info:
	ID               : 0x03000002
	Type             : V4L Video
Entity Info:
	ID               : 0x00000001 (1)
	Name             : HP HD Camera: HP HD Camera
	Function         : V4L2 I/O
	Flags         : default
	Pad 0x01000007   : 0: Sink
	  Link 0x02000013: from remote pad 0x100000a of entity 'Extension 4': Data, Enabled, Immutable
@charles-huet-ixxi
Copy link

I'm getting the exact same issue on Ubuntu 20.04, git ref 80f04cf.
Tried back up to 9fa373, same error.

Previous revisions give an issue with some missing python modules because I did not run the install script I guess.

$ v4l2-ctl -D

Driver Info:
        Driver name      : uvcvideo
        Card type        : HP HD Camera: HP HD Camera
        Bus info         : usb-0000:00:14.0-9
        Driver version   : 5.11.22
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format

@fangfufu
Copy link
Owner

Did you guys install the v4l2loopback DKMS module correctly?

@charles-huet-ixxi
Copy link

@fangfufu the v4l2loopback is from the ubuntu repo for me,

$ cat /proc/modules | grep -i v4l2loopback
v4l2loopback 40960 0 - Live 0x0000000000000000 (O)
videodev 245760 5 v4l2loopback,uvcvideo,videobuf2_v4l2,videobuf2_common, Live 0x0000000000000000

Looks correctly loaded to me.

I stumbled upon this issue though that makes me think it might be a version that does not work with pyfakewebcam : jremmons/pyfakewebcam#7

I'll try to update the module today to see if this fixes the issue

@cortex3
Copy link

cortex3 commented Oct 26, 2021

same here, I'm on the latest version of the module and the repo also using arch linux.

@fangfufu
Copy link
Owner

fangfufu commented Oct 26, 2021

I don't have Arch Linux installed to test this. Sorry. Can you guys try and use other software, like https://webcamoid.github.io/, to verify if your v4l2loopback actually works?

@charles-huet-ixxi
Copy link

I updated v4l2loopback to a manually-installed one (version 0.12.5) and now everything works fine.

Looks like there is a compatibility issue with some versions of v4l2loopback

@ngoonee
Copy link

ngoonee commented Oct 29, 2021

The current version of v4l2-loopback-dkms in [community] is 0.12.5 though. And it works fine for rendering OBS' video (I also have a modded v4l2loopback-dc for droidcam, maybe that could cause problems?)

@cortex3
Copy link

cortex3 commented Oct 29, 2021

@ngoonee I only have the v4l2loopback-dkms in version 0.12.5-2 from the community repository and it's not working for me either. I don't think your extra package is the cause.

@fangfufu I was unable to install webcamoid but my webcam works just fine in obs. I'm not entirely sure if it's using v4l2loopback-dkms there though.

@ngoonee
Copy link

ngoonee commented Oct 29, 2021

@ngoonee I only have the v4l2loopback-dkms in version 0.12.5-2 from the community repository and it's not working for me either. I don't think your extra package is the cause.

@fangfufu I was unable to install webcamoid but my webcam works just fine in obs. I'm not entirely sure if it's using v4l2loopback-dkms there though.

So here's the interesting thing, with more random attempts I got it working. I had to modify my modprobe.d/v4l2loopback.conf to remove my fixed numbers. So I guess Linux-Fake-Background-Webcam had issue finding the 'right' device to output to because I wasn't using consecutive numbers. Would probably be good to have both 'webcam-path' (as we have now) and 'output-path' or something like that so we can define both.

Still having issues though, since I can now apply this tool on my droidcam, but not on my integrated webcam due to it complaining about height and width not matching.... while it doesn't match for my droidcam device but it runs. More debugging required I guess.

@fangfufu
Copy link
Owner

@ngoonee , you need to specify the correct webcam. I guess you can specify the correct opening mode for your real webcam. Maybe your integrated webcam does not support the default resolution specified by the script.

@ashleysommer
Copy link

I had this same problem. I ran v4l2-ctl -D --list-devices and saw that my fake device was actually on /dev/video6
So I changed v4l2loopback-path in config.ini to /dev/video6 (and changed my webcam-path to the correct device for my real webcam too) then the software works as expected.

@fangfufu fangfufu added the bug Something isn't working label Jan 25, 2022
@fangfufu
Copy link
Owner

fangfufu commented Jan 25, 2022

I have the same problem too now. I upgraded my Debian, that's why.

It might be related to this:
jacksonliam/mjpg-streamer#229

Nevermind, I misconfigured the config file after moving the hard drive to a new machine... That was silly.

@fangfufu fangfufu pinned this issue Jan 25, 2022
@fangfufu fangfufu removed the bug Something isn't working label Jan 25, 2022
@fangfufu fangfufu unpinned this issue Jan 25, 2022
@raffaem
Copy link
Contributor

raffaem commented Feb 18, 2022

I have the exact same problem:

$ python3 fake.py
Real camera original values are set as: 0x0 with 0 FPS and video codec 0
Cannot set camera property 6 to 1196444237. Defaulting to auto-detected property set by opencv
Cannot set camera property 3 to 1280. Defaulting to auto-detected property set by opencv
Cannot set camera property 4 to 720. Defaulting to auto-detected property set by opencv
Cannot set camera property 5 to 30. Defaulting to auto-detected property set by opencv
Real camera new values are set as: 0x0 with 0 FPS and video codec 0
Traceback (most recent call last):
  File "/run/media/raffaele/55ab61c4-83cf-4d9f-a5cd-7fcfdc14b4fb/data/progetti_altrui/Linux-Fake-Background-Webcam/fake.py", line 495, in <module>
    main()
  File "/run/media/raffaele/55ab61c4-83cf-4d9f-a5cd-7fcfdc14b4fb/data/progetti_altrui/Linux-Fake-Background-Webcam/fake.py", line 484, in main
    cam = FakeCam(args)
  File "/run/media/raffaele/55ab61c4-83cf-4d9f-a5cd-7fcfdc14b4fb/data/progetti_altrui/Linux-Fake-Background-Webcam/fake.py", line 120, in __init__
    self.fake_cam = pyfakewebcam.FakeWebcam(self.v4l2loopback_path, self.width,
  File "/home/raffaele/pyvenv/virtualwebcam/lib64/python3.10/site-packages/pyfakewebcam/pyfakewebcam.py", line 54, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

I have tried everything.

Here are my devices:

$ v4l2-ctl -D --list-devices
OBS Virtual Camera (platform:v4l2loopback-000):
	/dev/video0

HD WebCam: HD WebCam (usb-0000:00:14.0-5):
	/dev/video1
	/dev/video2
	/dev/media0

Driver Info:
	Driver name      : v4l2 loopback
	Card type        : OBS Virtual Camera
	Bus info         : platform:v4l2loopback-000
	Driver version   : 5.16.9
	Capabilities     : 0x85208002
		Video Output
		Video Memory-to-Memory
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x05208002
		Video Output
		Video Memory-to-Memory
		Read/Write
		Streaming
		Extended Pix Format

@raffaem
Copy link
Contributor

raffaem commented Feb 18, 2022

allo-'s virtual_webcam_background works with v4l2loopback.

So I thinks it's a problem of this software.

@raffaem
Copy link
Contributor

raffaem commented Feb 18, 2022

The default values where all wrong for me.

It could not work not now not ever.

It worked after I called it like that:

python3 fake.py --webcam-path /dev/video1 --v4l2loopback-path /dev/video0

@dragonxtek
Copy link

I have the same issue. Webcamoid works but no fake.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants