windows 8 video capture issue

edited January 2014 in Questions about Code

Hello there, I'm having troubles to make my webcam work in Windows 8.1,

i already installed quicktime 7.7.4, winvdig 1.0.1 and GStreamer 1.0 (i thought that could help)

here's the code

import processing.video.*;
Capture cam;

void setup() {
  size(640, 480);
  println("oi");
  String[] cameras = Capture.list();
  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } 
  else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }

    cam = new Capture(this, 640, 480, cameras[0]);
    cam.start();
  }
}

void draw() {
  if (cam.available()) { 
    cam.read();
  }
  image(cam, 0, 0);
}

and what i'm getting...

oi JNA: Callback org.gstreamer.elements.AppSink$2@1c77f69 threw the following exception: java.lang.ExceptionInInitializerError at org.gstreamer.elements.AppSink.gst(AppSink.java:38) at org.gstreamer.elements.AppSink.pullBuffer(AppSink.java:128) at org.gstreamer.elements.BufferDataAppSink$AppSinkNewBufferListener.newBuffer(BufferDataAppSink.java:152) at org.gstreamer.elements.AppSink$2.callback(AppSink.java:184) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:455) at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:485) Caused by: java.lang.NullPointerException at com.sun.jna.Native.extractFromResourcePath(Native.java:797) at com.sun.jna.Native.extractFromResourcePath(Native.java:781) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:209) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322) at com.sun.jna.Library$Handler.(Library.java:142) at com.sun.jna.Native.loadLibrary(Native.java:387) at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:59) at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:51) at org.gstreamer.lowlevel.GstNative.load(GstNative.java:49) at org.gstreamer.lowlevel.AppAPI.(AppAPI.java:38) ... 10 more Available cameras: name=HP Webcam,size=640x480,fps=6 name=HP Webcam,size=640x480,fps=24 name=HP Webcam,size=352x288,fps=6 name=HP Webcam,size=352x288,fps=24 name=HP Webcam,size=320x240,fps=6 name=HP Webcam,size=320x240,fps=24 name=HP Webcam,size=176x144,fps=6 name=HP Webcam,size=176x144,fps=24 name=HP Webcam,size=160x120,fps=6 name=HP Webcam,size=160x120,fps=24 JNA: Callback org.gstreamer.Bus$15@e02324 threw the following exception: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.gstreamer.lowlevel.NativeObject.objectFor(NativeObject.java:191) at org.gstreamer.lowlevel.GTypeMapper$3.fromNative(GTypeMapper.java:129) at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:444) at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:485) Caused by: java.lang.NullPointerException at com.sun.jna.Native.extractFromResourcePath(Native.java:797) at com.sun.jna.Native.extractFromResourcePath(Native.java:781) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:209) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322) at com.sun.jna.Library$Handler.(Library.java:142) at com.sun.jna.Native.loadLibrary(Native.java:387) at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:59) at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:51) at org.gstreamer.lowlevel.GstNative.load(GstNative.java:49) at org.gstreamer.lowlevel.GstNative.load(GstNative.java:43) at org.gstreamer.message.ErrorMessage.(ErrorMessage.java:35) ... 8 more

If anyone can help me solve this I appreciate thanks

Answers

  • If you are using Processing 2.1.1, please note that the video library is not working properly on windows: https://github.com/processing/processing/issues/2327. Next stable release (2.1.2) will fix the problem but, as indicated on github, a temporary workaround until 2.1.2 is available consists in replacing the files gstreamer-java.jar and jna.jar in \modes\java\libraries\video\library with the ones from an earlier version of Processing (either 2.1 or 2.0.3)

  • It was just that, thank you so much =)

  • Ah! Thanks for the info :)

  • Your code works fine with 1.5.1 providing you do not use cam.start() ; on line 19

Sign In or Register to comment.