question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

For some reason I can't access my webcam on the Raspberry Pi

See original GitHub issue

After a few problems with the api, which i solved successfully, now i really dont know how to fix this: If i execute my code without the webcam plugged in everything is working as expected. But with my webcam plugged in i got the following exception:

My code:

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver;

public class DetectWebcamExample {
	static {
	     Webcam.setDriver(new V4l4jDriver()); // this is important
	}
	public static void main(String[] args) {
		Webcam webcam = Webcam.getDefault();
		if (webcam != null) {
			System.out.println("Webcam: " + webcam.getName());
		} else {
			System.out.println("No webcam detected");
		}
	}
}

The output with webcam:

Exception in thread "main" com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: au.edu.jcu.v4l4j.VideoDevice.doInit(Ljava/lang/String;)J
	at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
	at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:816)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:879)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:856)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:834)
	at DetectWebcamExample.main(DetectWebcamExample.java:14)
Caused by: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: au.edu.jcu.v4l4j.VideoDevice.doInit(Ljava/lang/String;)J
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:116)
	... 5 more
Caused by: java.lang.UnsatisfiedLinkError: au.edu.jcu.v4l4j.VideoDevice.doInit(Ljava/lang/String;)J
	at au.edu.jcu.v4l4j.VideoDevice.doInit(Native Method)
	at au.edu.jcu.v4l4j.VideoDevice.<init>(VideoDevice.java:271)
	at com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice.<init>(V4l4jDevice.java:66)
	at com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver.getDevices(V4l4jDriver.java:55)
	at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:36)
	at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:26)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.base/java.lang.Thread.run(Thread.java:844)


------------------
(program exited with code: 1)
Press return to continue

The Jars i used:

  • slf4j-nop-1.6.1
  • webcam-capture-driver-v4l4j-0.3.10-20140923.154112-11
  • slf4j-api-1.7.2
  • v4l4j-0.9.1-r507
  • webcam-capture-0.3.10

My Hardware:

  • Logitech C 170 (Im pretty sure its compatible)
  • Raspberry Pi 3B with Raspbian 9 (stretch)

Thanks for helping

Edit: Yesterday I tried the webcam of an friend and it was the same problem. I just wanted to be sure.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yuripourrecommented, Nov 21, 2019

I belive the FFMpeg drive has more chances to work because it doesn’t rely on JNI solutions, it may be less performant but since it uses Java Process it requires less configurations.

If you have issues, please, let me know.

1reaction
ysz0507commented, Nov 20, 2019

@ysz0507 Would you mind trying the ffmpeg driver? It was reported to be working with Raspberry Pi.

@yuripourre Sry I’ve just read this jet. Yes for sure, but i‘m not really confident because the same thing was written a few times about the V4L4J-Driver. But we will see maybe it will work. 👌🏻 thx for helping

Read more comments on GitHub >

github_iconTop Results From Across the Web

USB webcam problem - Raspberry Pi Forums
It looks like the camera doesn't get on with the Pi's USB. Its not unusual most of my webcams don't work with the...
Read more >
Raspberry Pi camera not detected? Try these simple steps
This problem can occur due to several reasons including a faulty camera, incorrect installation of the capturing device, loose connection, and ...
Read more >
Using USB webcams - The Raspberry Pi Guide
Nevertheless, there may be reasons why you want to connect a USB camera to your Raspberry Pi, such as because of the benefit...
Read more >
Common errors using the Raspberry Pi camera module
Are you trying to use the Raspberry Pi camera module, Python, and the picamera library? Did you run in to an error message?...
Read more >
How to Connect a Camera to a Raspberry Pi - Digikey
Utilize a common USB webcam ... If buying a new camera module is not feasible for your project, or if a higher resolution,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found