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

OSError: [Errno 22] Invalid argument fcntl.ioctl #7

Open
saifrahmed opened this issue Apr 12, 2020 · 10 comments
Open

OSError: [Errno 22] Invalid argument fcntl.ioctl #7

saifrahmed opened this issue Apr 12, 2020 · 10 comments

Comments

@saifrahmed
Copy link

Dear @jremmons - Firstly thanks for this project, this is exactly what I was looking for!

I tried running the project (both pip installed and via local pulls (both tagged release and master branch) but keep getting and "OSError: [Errno 22] Invalid argument" on the fcntl.ioctl call.

I tried using both webcams w/o success. I also did a
ls /dev | grep video
and tried the different devices w/o success.

Suspecting an issue with the settings object _v4l2.v4l2_format() I also tried to strip that down w/o success. I'm running on Ubuntu 18 with all the required dependency installs. Any suggestions on possible ways to debug this?

Traceback (most recent call last):
    camera = pyfakewebcam.FakeWebcam('/dev/video20', 640, 480)
  File "/home/sahmed/WORKSPACE/scantrac/ctnr-fakecam/pyfakewebcam/pyfakewebcam.py", line 54, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument
@enteryournamehere
Copy link

enteryournamehere commented Apr 15, 2020

I'm running into the same issue on Mint 19.3:

Traceback (most recent call last):
  File "webtest.py", line 11, in <module>
    camera = pyfakewebcam.FakeWebcam('/dev/video20', 640, 480)
  File "/usr/local/lib/python3.6/dist-packages/pyfakewebcam-0.1.0-py3.6.egg/pyfakewebcam/pyfakewebcam.py", line 56, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument

@jjenly
Copy link

jjenly commented Apr 15, 2020

its seems
Proposed solution was to install the kernel module from github instead of using the officially distributed v4l2-loopback package from Ubuntu 18.04

umlaeute/v4l2loopback#172

@enteryournamehere
Copy link

That seems to fix it, thanks!

@pedrodiamel
Copy link

Ubuntu 18.04
Linux 5.3.0-46-generic

#remove apt package
sudo modprobe -r v4l2loopback
sudo apt remove v4l2loopback-dkms

#install aux
sudo apt-get install linux-generic
sudo apt install dkms

#install v4l2loopback from the repository
https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback
make

#instal mod
sudo cp -R . /usr/src/v4l2loopback-1.1
sudo dkms add -m v4l2loopback -v 1.1
sudo dkms build -m v4l2loopback -v 1.1
sudo dkms install -m v4l2loopback -v 1.1
sudo reboot

@bgeels
Copy link

bgeels commented Oct 14, 2020

Do you happen to know if these steps are relevant for Ubuntu 20.04? Thanks!

@cahidenes
Copy link

Using video2 instead of video1 worked for me. (Ubuntu 20.04)

@Alwinator
Copy link

Alwinator commented May 3, 2021

I have the same problem with Ubuntu 21.04. (I have already tried all mentioned fixes). Any ideas?

@JanSurft
Copy link

I have the same problem with Ubuntu 21.04. (I have already tried all mentioned fixes). Any ideas?

Do sudo modprobe -r v4l2loopback

see the output of ls /dev/video*

In your modprobe command choose a virtual device number that is not already present.

In my case I used modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=7 card_label="v4l2loopback"

With 7 being an id that was not existing prior to activating v4l2loopback.

@Alwinator
Copy link

@JanSurft Thanks a lot! Now it works! I think the explicit phrase of the video ID did the trick.

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=7 card_label="v4l2loopback"
ls /dev/video*

image

@ghost
Copy link

ghost commented Aug 13, 2021

@JanSurft Thanks a lot! Now it works! I think the explicit phrase of the video ID did the trick.

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=7 card_label="v4l2loopback"
ls /dev/video*

image

For me, it was /dev/video20. Why does that happen, and can I set the number manually to 2?

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