有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法启动FrameGrabber

我正在使用Netbeans IDE,在尝试运行项目时发生了以下错误:

Exception in thread "Thread-1" java.lang.RuntimeException: Unable to start the FrameGrabber
    at org.imesha.examples.javacv.JavaCVExample.start(JavaCVExample.java:75)
    at java.base/java.lang.Thread.run(Thread.java:844)

如果您需要查看JavaCVE示例中的代码。java或pom。xml,请告诉我,我会编辑这篇文章。可能的解决方案是什么

编辑(更新):

在JavaCVExample的第75行附近编写代码。爪哇:

 public void start() {
      frameGrabber = new 
      FFmpegFrameGrabber("USB\\VID_090C&PID_71B3&MI_00\\6&9D4DD26&1&0000");
      frameGrabber.setFormat("DirectShow");
      frameGrabber.setImageWidth(640);
      frameGrabber.setImageHeight(480);

        logger.debug("Starting frame grabber");
        try {
            frameGrabber.start();
            logger.debug("Started frame grabber with image width-height : {}-{}", frameGrabber.getImageWidth(), frameGrabber.getImageHeight());
        } catch (FrameGrabber.Exception e) {
            logger.error("Error when initializing the frame grabber", e);
            throw new RuntimeException("Unable to start the FrameGrabber", e);
        }

        SwingUtilities.invokeLater(() -> {
            window.setVisible(true);
        });

        process();

        logger.debug("Stopped frame grabbing.");
    }

共 (0) 个答案