Processing can't find the camera - Video Libraries don't work

hey I had the same problem as you. I’m on Windows btw.
In my case the default Processing sketchfolder path had something interfering with recognizing the libraries path.
So I made a new Processing sketchfolder in a different hard drive and set that folder as the default sketchfolder in the Processing preference tab. Installed the video library there and it worked.
I hope this works for you.

Since it’s affecting all of your students on different OSes, it’s probably either a problem with the way Processing was installed and set up en masse, or a problem with your IT department having tightly restricted user permissions across the whole system, in which case you may have to get them involved.

I think @bjkim0215 is on the right track. Try pointing your sketchbook to a directory where you have high user privileges and reinstall the video library.

In windows just right click on processing.exe and select ‘run as administrator,’ but it won’t work unless you have admin credentials. If you do, reinstall the video library while running Processing as an admin. If that works, exit the program and run it as a normal user to see if it was a one-time fix.

If it still won’t work and IT is no help, you could try to run it from a thumb drive but that may or may not be an ordeal.

1 Like

Hola Neil :slight_smile:
In my case it worked, your solution allowed me to see myself, but the image is wrong. The image that gets displayed from the cam is squeezed on the ‘X’ axis, and also the image is mirrored.
Tried doing: cam = new Capture(this, 640, 480, "pipeline:autovideosrc"); thinking that the proportions were wrong, but the result was the same. :frowning: What do you think I could do?

Many thanks from the Dominican Rep.

First make sure that the resolution you are requesting is one that is supported by your camera. An easy way to do this on Windows is in the camera app under video settings: there is a dropdown which will show you all of the resolutions supported by your webcam. Alternatively use something like ffmpeg which can provide much more information if you need it.

Second make sure that you are not inadvertently stretching the image when you draw it by specifying incorrect dimensions.

Once you’ve ruled out these more common issues, you can try adjusting it in your pipeline with something like video/xraw, width=640, height=480. Check the gstreamer documentation and look for examples online if you decide to go this route.

The commonly prescribed solution to mirror your video is :

pushMatrix();
scale(-1,1);
image(cam, 0, 0);
popMatrix();

Other people seem to have success with this, but every time I have tried it, it has either not worked or killed my framerate, so I have started doing it through gstreamer with videoflip method=horizontal-flip

Append commands to your pipeline separated by ! until you get something you can work with in processing. Putting that together, your code will look something like: cam = new Capture(this, "pipeline: autovideosrc ! video/xraw, width=640, height=480 ! videoflip method=horizontal-flip");

2 Likes

After some updates (windows 11, processing 4 and clean install OS on my old machine) I was having problems with using the webcam.

After trying all the solutions listed here and also trying things like uninstalling OBS, install uninstall several versions of Gstreamer with Chocolatey, install uninstall the video library, the thing the solved the issue was to explicit provide the size of the sketch into instantiation of Capture like Capture(this, 640,360).