profox
January 17th, 2006, 06:44 AM
I'm trying to capture my webcam and save the capture as a png image. I installed JMF on my ubuntu machine, added the classpath etc. JMStudio is working great. i can capture my webcam.
but when i'm trying the same with my own program it doesn't work. here some code:
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("v4l:VideoCam Messenger sn9c101 Ov76:0");
MediaLocator mdl = new MediaLocator("v4l://0");
Player player = null;
try {
player = Manager.createRealizedPlayer(mdl);
} catch (IOException ioe ) {
System.out.println("Error: " + ioe);
}
player.start();
when i run the program, he's show's me every format the webcam supports like:
Trying 4 320 240
Format is RGB, 320x240, Length=230400, 24-bit, Masks=3:2:1, PixelStride=3, LineStride=960
and at the end he crashes with;
Exception on commit = java.io.IOException: Can't find registry file
java.io.IOException: java.lang.Error: Couldn't initialize capture device
java.io.IOException: java.lang.Error: Couldn't initialize capture device
Exception in thread "main" javax.media.NoPlayerException: Error instantiating cl ***: com.sun.media.protocol.v4l.DataSource : java.io.IOException: java.lang.Erro r: Couldn't initialize capture device
at javax.media.Manager.createPlayerForContent(Manager .java:1362)
at javax.media.Manager.createPlayer(Manager.java:417)
at javax.media.Manager.createRealizedPlayer(Manager.j ava:553)
at FrameGrab.main(FrameGrab.java:22)
when i'm trying some other code:
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("v4l:VideoCam Messenger sn9c101 Ov76:0");
Player player = null;
try {
player = Manager.createRealizedPlayer(deviceInfo.getLocator ());
} catch (IOException ioe ) {
System.out.println("Error: " + ioe);
}
player.start();
he quit's with the following error (immediately after i start the program):
Exception in thread "main" java.lang.NullPointerException
at FrameGrab.main(FrameGrab.java:21)
and i have realy no id why, and how to solve this problem. the device name's are 100% ok, i copied them from JMF Registry. And i tried more than once to detect new capture devices. Why is my program not working, but JMStudio is working fine?
but when i'm trying the same with my own program it doesn't work. here some code:
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("v4l:VideoCam Messenger sn9c101 Ov76:0");
MediaLocator mdl = new MediaLocator("v4l://0");
Player player = null;
try {
player = Manager.createRealizedPlayer(mdl);
} catch (IOException ioe ) {
System.out.println("Error: " + ioe);
}
player.start();
when i run the program, he's show's me every format the webcam supports like:
Trying 4 320 240
Format is RGB, 320x240, Length=230400, 24-bit, Masks=3:2:1, PixelStride=3, LineStride=960
and at the end he crashes with;
Exception on commit = java.io.IOException: Can't find registry file
java.io.IOException: java.lang.Error: Couldn't initialize capture device
java.io.IOException: java.lang.Error: Couldn't initialize capture device
Exception in thread "main" javax.media.NoPlayerException: Error instantiating cl ***: com.sun.media.protocol.v4l.DataSource : java.io.IOException: java.lang.Erro r: Couldn't initialize capture device
at javax.media.Manager.createPlayerForContent(Manager .java:1362)
at javax.media.Manager.createPlayer(Manager.java:417)
at javax.media.Manager.createRealizedPlayer(Manager.j ava:553)
at FrameGrab.main(FrameGrab.java:22)
when i'm trying some other code:
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("v4l:VideoCam Messenger sn9c101 Ov76:0");
Player player = null;
try {
player = Manager.createRealizedPlayer(deviceInfo.getLocator ());
} catch (IOException ioe ) {
System.out.println("Error: " + ioe);
}
player.start();
he quit's with the following error (immediately after i start the program):
Exception in thread "main" java.lang.NullPointerException
at FrameGrab.main(FrameGrab.java:21)
and i have realy no id why, and how to solve this problem. the device name's are 100% ok, i copied them from JMF Registry. And i tried more than once to detect new capture devices. Why is my program not working, but JMStudio is working fine?