Coder Social home page Coder Social logo

eduramiba / webcam-capture-driver-native Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 8.0 4.95 MB

Native driver for Webcam Capture API

C++ 65.61% C 2.06% Java 32.33%
webcam-capture native driver capturemanager windows mediafoundation java javafx avfoundation

webcam-capture-driver-native's Introduction

Introduction

This is a native driver for Webcam Capture that is reliable, has very good performance, fast startup time and is able to correctly list the detailed capabilities of video devices such as resolutions and device IDs.

Currently it works on Windows and Mac.

For Windows, it uses the CaptureManagerDriver, based on CaptureManager-SDK, which uses the MediaFoundation Windows API. For Mac, it uses AVFDriver, based on a custom library that uses AVFoundation.

How to use

  1. Add io.github.eduramiba:webcam-capture-driver-native:1.0.0 dependency to your application.
  2. Use the driver with Webcam.setDriver(new NativeDriver())
  3. List the devices with Webcam.getWebcams() as normal and use the library in your preferred way. In JavaFX it's recommended to do it as in the example below.

Simple example with JavaFX

import com.github.eduramiba.webcamcapture.drivers.NativeDriver;
import com.github.eduramiba.webcamcapture.drivers.WebcamDeviceWithBufferOperations;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamDevice;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDriver extends Application {

    private static final Logger LOG = LoggerFactory.getLogger(TestDriver.class);

    public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);

    public static void main(String[] args) {
        Webcam.setDriver(new NativeDriver());

        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        final ImageView imageView = new ImageView();
        final HBox root = new HBox();
        root.getChildren().add(imageView);

        Webcam.getWebcams().stream()
                .findFirst()
                .ifPresent((final Webcam camera) -> {
                    final WebcamDevice device = camera.getDevice();
                    LOG.info("Found camera: {}, device = {}", camera, device);

                    final int width = device.getResolution().width;
                    final int height = device.getResolution().height;
                    final WritableImage fxImage = new WritableImage(width, height);
                    Platform.runLater(() -> {
                        imageView.setImage(fxImage);
                        stage.setWidth(width);
                        stage.setHeight(height);
                        stage.centerOnScreen();
                    });

                    camera.getLock().disable();
                    camera.open();
                    if (device instanceof WebcamDeviceWithBufferOperations) {
                        final WebcamDeviceWithBufferOperations dev = ((WebcamDeviceWithBufferOperations) device);
                        EXECUTOR.scheduleAtFixedRate(new Runnable() {
                            private long lastFrameTimestamp = -1;

                            @Override
                            public void run() {
                                if (dev.updateFXIMage(fxImage, lastFrameTimestamp)) {
                                    lastFrameTimestamp = dev.getLastFrameTimestamp();
                                }

                            }
                        }, 0, 16, TimeUnit.MILLISECONDS);
                    }
                });

        stage.setOnCloseRequest(t -> {
            Platform.exit();
            System.exit(0);
        });

        // Create the Scene
        final Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("Webcam example");
        stage.show();
    }
}

Future work

  • Implement Linux driver

Notes

The source code in natives folder and capturemanager java package has been copied from CaptureManager-SDK and slightly improved for this driver. This code is not idiomatic java and needs improvement. The DLLs for Windows can just be copied along with your program.

The native dynamic libraries for Mac are on src/main/resources and loaded by JNA from inside the JAR. Note that if you want to distribute a Mac app you will need to properly codesign the dylib files with entitlements, have an Info.plist, notarization...

webcam-capture-driver-native's People

Contributors

akexorcist avatar eduramiba avatar msgilligan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

webcam-capture-driver-native's Issues

Issue with non-unique camera names for multiple webcams on macOS with M1

Hello,

I am currently facing a challenge with the webcam-capture-driver-native library in my project where I have connected 3 identical webcams (Hikvision DS-U02) to my computer. These webcams are identified by non-unique names by the library. This issue prevents me from distinguishing between these cameras and working with them individually to capture video streams simultaneously.

Here is an example of how the camera names are detected by the library:

  • 1080P USB Camera
  • 1080P USB Camera
  • 1080P USB Camera
  • HD-камера FaceTime

The three "1080P USB Camera" entries correspond to the Hikvision DS-U02 webcams. Their identical names make it impossible to select and use each webcam independently, which is crucial for my application.

This issue arises from the use of the library with the com.github.sarxos.webcam package, specifically when trying to lock a webcam for exclusive access (WebcamLock.class)
The non-unique names cause conflicts in the locking mechanism, preventing simultaneous use of the cameras.

Suggested Feature / Fix:
It would be highly beneficial if the library could provide a way to generate unique identifiers for each webcam, possibly incorporating attributes such as connection port or an internal index. This would allow applications to distinguish between multiple webcams with otherwise identical names.

Environment:

  • Operating System: macOS with M1 Processor
  • Library version: 1.0.0
  • Java version: 20.0.1 (OpenJDK)

Split into 3 JARs

It would be nice if this could be split into 3 JARs:

  1. A standalone JAR for the macOS driver
  2. A standalone JAR for the Windows driver
  3. A combined (either merged or using transitive dependencies) JAR that contains the combined NativeDriver class and behaves the same as the current JAR.

This will reduce the size of the JARs and their dependencies for apps that don't need everything.

I also think the JavaFX dependency should probably be removed.

All black image on OSX

I'm trying for the first time on OSX, and getting an all-black image. Macbook M1 Pro, Sonoma (14.5)

// Mac OSX
Webcam.setDriver(NativeDriver())
Webcam.getWebcams().forEach { webcam ->
    println(webcam)
    println(" ${webcam.viewSizes.joinToString { "${it.size.width}x${it.size.height}" }}")
}
val webcam = Webcam.getDefault()
webcam.open()
repeat(20) {
   // warm up, or allow auto-levels
    webcam.image
}
val img = webcam.image
println("Image: ${img.width}x${img.height}")
ImageIO.write(img, "PNG", File("hello-world.png"))
webcam.close()

Build with

    implementation("com.github.sarxos:webcam-capture:0.3.13-SNAPSHOT")
    implementation("org.slf4j:slf4j-api:2.0.12")
    implementation("org.slf4j:slf4j-simple:2.0.13")

    // Getting it working on Mac OSX
    implementation("io.github.eduramiba:webcam-capture-driver-native:1.0.0")

ERROR c.g.e.w.d.c.CaptureManagerDriver - Unexpected error listing video devices

Java 21
IntelliJ IDEA 2023.2.5
com.github.sarxos:webcam-capture:0.3.12
this library v1.0.0

README documentation does not mention modules. Workaround is to add requires io.github.eduramiba.webcamcapture;

Running the application as recommended, I get

14:38:26.220 [main] DEBUG com.github.sarxos.webcam.Webcam - Setting new capture driver com.github.eduramiba.webcamcapture.drivers.NativeDriver@4e096385
14:38:26.239 [webcam-discovery-service] ERROR c.g.e.w.d.c.CaptureManagerDriver - Unexpected error listing video devices
java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\me\Documents\GitHub\myApp\CaptureManager.dll
14:38:26.241 [main] INFO  c.g.s.webcam.WebcamDiscoveryService - Discovery will not run - driver NativeDriver does not support this feature

I believe it's looking in the wrong place for the native driver.

Support for WebcamDiscoverySupport

I'm new to both of these libraries, but when I try to use WebcamDiscovery it fails due to the driver not implementing WebcamDiscoverySupport

macOS M1 frame size issues

on macOS Mojave, Mac M1, running the sample app using the built-in FaceTime camera:

name='FaceTime HD Camera', resolutions=[java.awt.Dimension[width=1920,height=1080], java.awt.Dimension[width=1280,height=720], java.awt.Dimension[width=1080,height=1920], java.awt.Dimension[width=1760,height=1328], java.awt.Dimension[width=640,height=480], java.awt.Dimension[width=1328,height=1760], java.awt.Dimension[width=1552,height=1552]

I'm seeing the following resolutions display "diagonal-striped" video:

  • [width=1080,height=1920]
  • [width=1328,height=1760]
  • [width=1552,height=1552]

It seems all the cases where height >= width, but I don't know if this is the actual cause.

The following workaround was used because the default size was failing:

        final Dimension dimension = new Dimension( 1920, 1080);
        device.setResolution(dimension);

Can't display camera stream on some resolutions on Windows

Hi @eduramiba,

I just tested the project and have some issues on Windows 10, not MacOS. Same on a colleage laptop.
I ran TestDriver.java from the project. It does not display anything.

What I notice is it works with a resolution of 160x120, 320x180, 320x240 but not beyond.

Here are the logs when I switched to 160*120, then the ones in 640 * 480

14:40:02.784 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Closing webcam Integrated Webcam
14:40:02.784 [atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamCloseTask -- Closing Integrated Webcam
INFO_LEVEL: SessionProcessor: stopCapture - capture is stopped!!!  Error code: 0000000000, Description: Success with the result.
INFO_LEVEL: SessionProcessor: closeSession - session is closed!!!  Error code: 0000000000, Description: Success with the result.
14:40:03.073 [Thread-7] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (7, 1)
14:40:03.074 [Thread-8] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (9, 1)
14:40:03.079 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Webcam Integrated Webcam has been closed
14:40:03.079 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Setting new resolution 160x120
14:40:03.080 [atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask -- Opening webcam Integrated Webcam
14:40:03.080 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Media types for resolution 160x120 = [CaptureManagerMediaType{width=160, height=120, majorType=MFMediaType_Video, subType=MFVideoFormat_YUY2}]
14:40:03.080 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Media types for resolution 160x120 = [CaptureManagerMediaType{width=160, height=120, majorType=MFMediaType_Video, subType=MFVideoFormat_YUY2}]
14:40:03.081 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Using video media type: CaptureManagerMediaType{width=160, height=120, majorType=MFMediaType_Video, subType=MFVideoFormat_YUY2}
INFO_LEVEL: SessionProcessor: setTopology - topology is ready!!!  Error code: 0000000000, Description: Success with the result.
14:40:03.210 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- Successfully created CallSessionControl
INFO_LEVEL: SessionProcessor: startCapture - capture is started!!!  Error code: 0000000000, Description: Success with the result.
14:40:03.356 [Thread-9] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (5, 2)
14:40:03.355 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Webcam is now open Integrated Webcam
14:40:21.155 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Closing webcam Integrated Webcam
14:40:21.155 [atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamCloseTask -- Closing Integrated Webcam
INFO_LEVEL: SessionProcessor: stopCapture - capture is stopped!!!  Error code: 0000000000, Description: Success with the result.
INFO_LEVEL: SessionProcessor: closeSession - session is closed!!!  Error code: 0000000000, Description: Success with the result.
14:40:21.444 [Thread-10] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (7, 2)
14:40:21.444 [Thread-11] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (9, 2)
14:40:21.446 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Webcam Integrated Webcam has been closed
14:40:21.446 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Setting new resolution 640x480
14:40:21.446 [atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask -- Opening webcam Integrated Webcam
14:40:21.446 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Media types for resolution 640x480 = [CaptureManagerMediaType{width=640, height=480, majorType=MFMediaType_Video, subType=MFVideoFormat_NV12}, CaptureManagerMediaType{width=640, height=480, majorType=MFMediaType_Video, subType=MFVideoFormat_MJPG}, CaptureManagerMediaType{width=640, height=480, majorType=MFMediaType_Video, subType=MFVideoFormat_YUY2}]
14:40:21.446 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Media types for resolution 640x480 = [CaptureManagerMediaType{width=640, height=480, majorType=MFMediaType_Video, subType=MFVideoFormat_NV12}]
14:40:21.446 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice -- Using video media type: CaptureManagerMediaType{width=640, height=480, majorType=MFMediaType_Video, subType=MFVideoFormat_NV12}
INFO_LEVEL: SessionProcessor: setTopology - topology is ready!!!  Error code: 0000000000, Description: Success with the result.
14:40:21.548 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- Successfully created CallSessionControl
INFO_LEVEL: SessionProcessor: startCapture - capture is started!!!  Error code: 0000000000, Description: Success with the result.
14:40:21.722 [JavaFX Application Thread] DEBUG com.github.sarxos.webcam.Webcam -- Webcam is now open Integrated Webcam
14:40:21.722 [Thread-12] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession -- invoke with (aCallEventCode, aSessionDescriptor) = (5, 3)

What should I check to have more information? Have you ever notice this problem?

Here is the code used to add a resolution choice box.
Also notice that camera.close() is not enough to close the camera. It must be followed by dispose().

package com.github.eduramiba.webcamcapture;

import com.github.eduramiba.webcamcapture.drivers.NativeDriver;
import com.github.eduramiba.webcamcapture.drivers.WebcamDeviceWithBufferOperations;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamDevice;

import java.awt.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import com.github.sarxos.webcam.WebcamResolution;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDriver extends Application {

    private static final Logger LOG = LoggerFactory.getLogger(TestDriver.class);

    public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);

    public static void main(String[] args) {
        Webcam.setDriver(new NativeDriver());

        launch(args);
    }

    public void changeResolution(Webcam camera, Dimension dimension) {
        camera.close();
        camera.getDevice().dispose();
        camera.setViewSize(dimension);
        camera.open();
    }

    @Override
    public void start(Stage stage) throws Exception {
        final ImageView imageView = new ImageView();
        final ChoiceBox<Dimension> resolutionChoiceBox = new ChoiceBox<>();
        resolutionChoiceBox.setConverter(new StringConverter<>() {

            @Override
            public String toString(Dimension dimension) {
                return dimension != null ? dimension.width + " x " + dimension.height : null;
            }

            @Override
            public Dimension fromString(String s) {
                return null;
            }
        });
        final HBox root = new HBox();
        root.getChildren().addAll(imageView, resolutionChoiceBox);

        Webcam.getWebcams().stream()
                .findFirst()
                .ifPresent((final Webcam camera) -> {
                    final WebcamDevice device = camera.getDevice();

                    resolutionChoiceBox.setItems(FXCollections.observableArrayList(device.getResolutions()));
                    camera.setViewSize(WebcamResolution.QVGA.getSize());
                    resolutionChoiceBox.getSelectionModel().select(WebcamResolution.QVGA.getSize());
                    resolutionChoiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Dimension>() {
                        @Override
                        public void changed(ObservableValue<? extends Dimension> observableValue, Dimension oldValue, Dimension newValue) {
                            changeResolution(camera, newValue);
                        }
                    });

                    LOG.info("Found camera: {}, device = {}", camera, device);

                    final int width = device.getResolution().width;
                    final int height = device.getResolution().height;
                    final WritableImage fxImage = new WritableImage(width, height);
                    Platform.runLater(() -> {
                        imageView.setImage(fxImage);
                        stage.setWidth(width + 100);
                        stage.setHeight(height + 100);
                        stage.centerOnScreen();
                    });

                    camera.getLock().disable();
                    camera.open();
                    if (device instanceof WebcamDeviceWithBufferOperations) {
                        final WebcamDeviceWithBufferOperations dev = ((WebcamDeviceWithBufferOperations) device);
                        EXECUTOR.scheduleAtFixedRate(new Runnable() {
                            private long lastFrameTimestamp = -1;

                            @Override
                            public void run() {
                                if (dev.updateFXIMage(fxImage, lastFrameTimestamp)) {
                                    lastFrameTimestamp = dev.getLastFrameTimestamp();
                                }

                            }
                        }, 0, 16, TimeUnit.MILLISECONDS);
                    }
                });

        stage.setOnCloseRequest(t -> {
            Platform.exit();
            System.exit(0);
        });

        // Create the Scene
        final Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("Webcam example");
        stage.show();
    }
}

Thanks for your feedback, and your great work ;)

Webcam close and open

After having close and open a webcam is not possible to open anymore!

This is the code :
`
Webcam.setDriver(new CaptureManagerDriver());
Webcam webcam = Webcam.getWebcams().get(4);

    long t1, t2;

    for (int i = 0; i < 5; i++) {

        try {
            System.out.format("Opening...\n");

            t1 = System.currentTimeMillis();
            webcam.open();
            t2 = System.currentTimeMillis();

            System.out.format("Opening time: %d ms\n", t2 - t1);
            System.out.format("Fetch image...\n");

            t1 = System.currentTimeMillis();
            if (webcam.getImage() == null) {
                System.err.println("Damn! Image is null!");
            }
            t2 = System.currentTimeMillis();

            System.out.format("Fetch image time: %d ms\n", t2 - t1);
            System.out.format("Closing...\n");

            t1 = System.currentTimeMillis();
            webcam.close();
            t2 = System.currentTimeMillis();

            System.out.format("Closing time: %d ms\n", t2 - t1);
            System.out.format("Wait 5 seconds...\n", t2 - t1);

            Thread.sleep(5000);
        } catch (InterruptedException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
    }

    System.out.format("Done...\n");

`
image

Without the loading of the driver

image

Inconsistency in WebcamDevice#getImage Method Implementation and its Impact on WebcamPanel Repainting

The WebcamDevice#getImage method is implemented inconsistently compared to the built-in WebcamDefaultDevice, which returns a new BufferedImage object. This inconsistency currently results in the WebcamPanel not executing repaintPanel().

This line always evaluates to true. https://github.com/sarxos/webcam-capture/blob/fdfcaea80c8f50eeb8f7c24475ff85a3c1fdcb32/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamPanel.java#L603

Camera settings

Please tell me how to manipulate camera settings such as exposure, brightness, contrast, etc.

ASync mode not working

If open the webcam in async mode it will no wait untill a new photo is grabbed but give you back a blank image instead of waiting...

Webcam is not showing any preview nor the webcam is opening

I'm getting issue with this library, the webcam is not opening nor I see any preview on the UI. Below are the debug logs.

INFO_LEVEL: ***** CAPTUREMANAGER SDK 1.19.1 Freeware - Sep 4 2021 (Author: Evgeny Pereguda) ***** INFO_LEVEL: MediaFoundationManager: Media Foundation is initialized!!! INFO_LEVEL: DMOManager: DMO is initialized!!! 2766 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - start 2778 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - start 2780 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2799 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFAudioFormat_Float 2813 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - ok 2814 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - ok 2814 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - start 2815 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - start 2815 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2817 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_YUY2 2841 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2843 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_YUY2 2843 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2844 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_YUY2 2844 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - ok 2845 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - ok 2845 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - start 2846 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - start 2846 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2847 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2847 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2848 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2848 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2849 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2849 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2850 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2850 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2852 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2852 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2853 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2853 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2854 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFVideoFormat_ARGB32 2855 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - ok 2855 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - ok 2856 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - start 2857 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - start 2857 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - start 2857 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse media type - correct - subtype = MFAudioFormat_Float 2858 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse stream descriptor - ok 2858 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse source - ok 2858 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Premature end of XML stream at root. Event type = 257 2864 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2865 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2871 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2871 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2871 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2871 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2872 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2872 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2872 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2873 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2873 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2873 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2874 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2874 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2875 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2875 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2876 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2876 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2876 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2876 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2877 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2877 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2877 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2877 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2878 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2878 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2878 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2878 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2879 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2879 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2879 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2879 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2880 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - start 2880 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - start 2880 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink value part - ok 2880 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Parse sink factory - ok 2881 [webcam-discovery-service] DEBUG com.github.eduramiba.webcamcapture.drivers.capturemanager.model.parser.CaptureManagerModelXMLParser - Premature end of XML stream at root. Event type = 257 2897 [Thread-8] INFO com.github.sarxos.webcam.WebcamDiscoveryService - Discovery will not run - driver CaptureManagerDriver does not support this feature Selected camera is: FaceTime HD Camera 2902 [Thread-9] INFO com.github.sarxos.webcam.WebcamDiscoveryService - Discovery will not run - driver CaptureManagerDriver does not support this feature 2903 [Thread-9] DEBUG com.github.sarxos.webcam.WebcamLock - Lock Webcam FaceTime HD Camera 2930 [atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask - Opening webcam FaceTime HD Camera 2949 [atomic-processor-1] INFO com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerVideoDevice - Using video media type: CaptureManagerMediaType{width=1280, height=720, majorType=MFMediaType_Video, subType=MFVideoFormat_YUY2} 3001 [atomic-processor-1] ERROR com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession - Could not create session control last step 3002 [atomic-processor-1] ERROR com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession - Call init before start!! 3005 [Thread-9] DEBUG com.github.sarxos.webcam.Webcam - Webcam is now open FaceTime HD Camera

Open multiple webcam

First of all great library.

I've problem open multiple webcam. Untill 2 webcam everythings is fine... i need to open 6.
Error is the following :

Exception in thread "main" com.github.sarxos.webcam.WebcamLockException: Webcam USB has already been locked

When no use your driver everythings is working well...

Any ideas?

Can't find any webcams on Windows

Hello! I have a question, not an issue. It works fine on my Mac, but can't find any webcams on Windows 11 laptop or desktop
What am I doing wrong?

PXL_20240423_155855627~2.jpg

What about Libgdx OGL Texture support ?

It would be good to see Libgdx support with direct opengl textures and LibGDX Textures for performance.
We can also use opengl shaders directly to webcam with that.

Some people prefer JOGL.
I had example for that i will post you if you want.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.