Closed sarxos closed 9 years ago
Please take a look at:
This message is printed when EOFException
is caught. This means most probably that end of stream has been reached unexpectedly when reading input. Is it possible to test this camera online? Does it work directly from web browser, or you get similar problems?
it works fine with browser I also check my code with these urls : http://96.10.1.168 http://wmccpinetop.axiscam.net but I got same error does it related to memory or something like this ?
I also checked this your sample :
static {
Webcam.setDriver(new IpCamDriver());
}
public static void main(String[] args) throws MalformedURLException {
String name = "Test #255";
URL url = new URL("http://ce3014.myfoscam.org:20054/videostream.cgi");
IpCamMode mode = IpCamMode.PUSH;
IpCamAuth auth = new IpCamAuth("user", "user");
IpCamDeviceRegistry.register(name, url, mode, auth);
Webcam w = Webcam.getWebcams().get(0);
w.open();
WebcamPanel panel = new WebcamPanel(w);
JFrame f = new JFrame("Test #255 PUSH");
f.add(panel);
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
but the line w.open() never finished !! I mean when I debug this code , w.open() takes a lot of time and never finished correctly or by exception
today I tried below code with your last release of libraries and I got video . public class Test {
static {
Webcam.setDriver(new IpCamDriver());
}
public static void main(String[] args) throws MalformedURLException {
String name = "Test #255";
String url = "http://ce3014.myfoscam.org:20054/videostream.cgi";
IpCamMode mode = IpCamMode.PUSH;
IpCamAuth auth = new IpCamAuth("user", "user");
IpCamDeviceRegistry.register(name, url, mode, auth);
Webcam w = Webcam.getWebcams().get(0);
w.open();
WebcamPanel panel = new WebcamPanel(w);
panel.setFPSLimit(1);
JFrame f = new JFrame("Test #255 PUSH");
f.add(panel);
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
but when I changed url to this : "http://192.168.1.6" some wrong thing happend Instead of library i download all open source code and test with them again I trace and trace until this line :
if (open.compareAndSet(false, true)) {
}
this line is open()
method from Webcam
class
when the program goes into this line never get out of it !!!
what does compareAndSet()
do ? how can I solve this problem ?
Hi @omidhaghighatgoo,
Sorry for late response. I was busy with preparations to Christmas Eve.
In regards to your issue:
I tested http://wmccpinetop.axiscam.net which points to MJPEG image available at http://wmccpinetop.axiscam.net/mjpg/video.mjpg and it's working well, though it's opening pretty slow (this is due to the low camera speed, connection, or network route speed).
The source code I used for this test:
import java.net.MalformedURLException;
import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.ds.ipcam.IpCamDeviceRegistry;
import com.github.sarxos.webcam.ds.ipcam.IpCamDriver;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;
public class Test {
static {
Webcam.setDriver(new IpCamDriver());
}
public static void main(String[] args) throws MalformedURLException {
String name = "Test Issue #287";
String url = "http://wmccpinetop.axiscam.net/mjpg/video.mjpg";
IpCamMode mode = IpCamMode.PUSH;
IpCamDeviceRegistry.register(name, url, mode);
JFrame f = new JFrame(name);
f.add(new WebcamPanel(Webcam.getDefault()));
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
For the http://192.168.1.6 I'm getting Network Connection Error so it's obvious that API will not work with that.
And for the http://96.10.1.168 which points to the image at http://96.10.1.168/jpg/1/image.jpg, which is JPEG (not MJPEG) the PULL
mode (the client pull out the JPG image every time) must be used instead of PUSH
(server push new frame in MJPEG stream), the camera is working just perfectly. I'm getting more smooth image than in the previous one (but this is again due to the connection speed because PUSH
is much faster than PULL
).
The source code I used for this test:
import java.net.MalformedURLException;
import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.ds.ipcam.IpCamDeviceRegistry;
import com.github.sarxos.webcam.ds.ipcam.IpCamDriver;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;
public class Test {
static {
Webcam.setDriver(new IpCamDriver());
}
public static void main(String[] args) throws MalformedURLException {
String name = "Test Issue #287";
String url = "http://96.10.1.168/jpg/1/image.jpg";
IpCamMode mode = IpCamMode.PULL;
IpCamDeviceRegistry.register(name, url, mode);
JFrame f = new JFrame(name);
f.add(new WebcamPanel(Webcam.getDefault()));
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
You are asking what does the compareAndSet(boolean, boolean)
do? The detailed answer can be found in Javadoc (this is AtomicBoolean
available in all the Java versions starting from Java 5). This method compare if current atomic reference value equals the one in first argument and set its value to second argument if comparison is true. This operation is atomic and non-blocking so it can be safely used (and should be used) in multithreaded applications. For more details please take a look at Java Concurrency API. It's impossible for this method to block (because it has been designed to not block at all) and it's usually used to make sure that some operation will be executed once and only once, always. If your debugger points out that this method is blocking then I can assume that you have wrong source code (incorrect version) or the debugger is somehow configured incorrectly.
If you are using IP camera and open()
method is blocking it's pretty commonly caused by the fact that API is waiting for the remote end to serve some content. It will block until timeout (like in regular web application) or to the moment when remote end send the response or close the socket connection.
Thank you very very veeeeeeeeeeeeeeery much and *** HAPPY NEW YEAR *** I finally find the problem ! the problem was with URL . each camera has it's own URL that is specific and depends on brand and model i test these urls for my camera : url = ip address url = ip address:port and ... but none of them was correct unfortunately there wasn't any thing on manual or data sheet finally i found correct camera url on this site :
Great to hear good news :) I also wish you a Happy New Year! Take care, I'm closing this ticket.
Webcam webcam = Webcam.getDefault(); webcam.open(); BufferedImage bufferedImage = webcam.getImage(); LOG.info("BufferedImage", bufferedImage);
I get null printed what can I be doing wrong?
@betrand what is your IP camera URL, are you using JPEG or MJPEG?
Thank you.Am on a windows machine with built in Camera. I have tried accessing the camera as belowLOG.info("Webcam name: webcam.getName()");I get Webcam name: Chicony USB 2.0 Camera 0Kind regardsSent from Yahoo Mail for iPadAt 11 Feb 2015 16:13:24, Bartosz Firyn wrote:@betrand what is your IP camera URL, are you using JPEG or MJPEG?
—Reply to this email directly or view it on GitHub.
@betrand, thank you for clarification. This thread is about EOFs in MJPEG stream, so lets move this discussion to #308 you've created.
Hi Bartosz. It's been a long time I tried your API. Does it support Fingerprint capture and verification now?
Thank you and Kind regards Betrand Senior Java Architect/DeveloperEMB ERP ConsultantUptitek Ltd
Hi @betrand,
Unfortunately I haven't found any way to reliably support finger print images. There is libfprint-java project, but it seems that not all finger print readers are supported. For example I was unable to use libfprint with a finger print reader embedded in my HP EliteBook ([138a:003c] Validity VFS471 Fingerprint Reader).
However, you may try it out yourself to check if maybe your finger print reader is supported.
I picked up SecuGen fingerprint reader though they have java SDK I thought I should try out your Lib to see if it will detect it as a camera device. If it does then I can go that direction
Issue from Omid Haghighatgoo:
hi I want to use your amazing sarxos project for getting images from an ip camera I used your sample code like this :
and my camera is this :
http://www.brickcom.com/products/DetailView.php?modelname=CB-100Ae
but the result is below message :
what is the problem ? I will really appreciate any help
thank you