Link to home
Start Free TrialLog in
Avatar of MILIND_JOG
MILIND_JOGFlag for India

asked on

CaptureDeviceManager.getDeviceList not returning any value

Dear Expert,

I am new in javax media. I am trying to make an application to capture photograph from USB camera. The problem is CaptureDeviceManager.getDeviceList not returning any value.
Please help. I have already downloaded JMF2.1.1 and included jar file in my NetBeans system to compile. The compilation is successful.

Please help.

Regards
captcam.java
Avatar of MILIND_JOG
MILIND_JOG
Flag of India image

ASKER

Please give your expert sugestion.

Regards
Avatar of krakatoa
Thanks for your comments. I think there is an setup issue. I am unable to fix. Setup from Download of correct version,NetBeans liabrary to CLASSPATH & PATH etc...

Can you please guide me.

Regards
Sorry, not on the setup issue, no - I don't use Netbeans.
Ok. No problem. Forget about NetBeans. Otherwise.

Regards
I am observing that CaptureDeviceManager.getDeviceList(null); not returning any device.

Regards
You can post some code, perhaps? (If so, please use the code tags here). Thanks.
Dear Krakatoa,
Thanks for taking efforts to resolve my issue. I have already attached the code. If you want I can repost the same.

Regards
OK well I compiled and ran your class. I got a long list of devices in a window. I didn't make a selection, but dismissed the window, and was presented with a jframe or smthg asking me if I wanted to make a capture, and an OK button. I pressed that, got some shutter clicking sounds from my machine, then there was a NullPointerException, and things closed.

Does that help?

BUT - my camera is built-in - it's *not* attached via USB.
I am also working in LAPTOP and camera is builtin. I do not understand what is the issue. I suspect the issue is with Setup

Regards
But *do you* get as far as being offered a 'capture'?
No I struck at the line CaptureDeviceManager.getDeviceList(null); . Unable to move further
The line not detecting any device
Can you please advice me the currect version of JMF, the URL to download and the setup steps in local machine no matter NetBeans.

Regards
Your code works - for me - up until trying to do the capture. The NPE is on this line :

Buffer buf = fgc.grabFrame();
You should find it all explained and available here :

http://www.oracle.com/technetwork/java/javase/download-142937.html
Ok. Let me see. I will come back to you. By the I am in India and it is already 10:30PM. What is your local time and what time generally you available. I am asking you for the reason that I am getting very very good support from you and I do not want to break the link

Regards
You won't break the link. I can't promise I can help however.

Try to get a list of the devices that your machine has. I thought I saw a list of audio capture devices returned by your code, not video capture devices, but I could be wrong.
Good morning krakatoa,
I am extremely sorry. Before I read your message, I moved out of link. I hope you wouldn't mind.
Now I am able to see devices but all are Audio as you also observed. Till you are available, I am trying to resolve by different means but definately require your support as soon as possible.

Thanks & Regards.
1) :
Vector deviceList =CaptureDeviceManager.getDeviceList(new VideoFormat("yuv"));

Open in new window


2) : Start, Programs, JMedia Framework, JMF Registry, Capture Devices.

See what these tell you.
Sir, I got the device now. I am now facing next problem as an exception on line

player = Manager.createRealizedPlayer(ml);

Exception in thread "VFW Request Thread" java.lang.UnsatisfiedLinkError: JMFSecurityManager: java.lang.UnsatisfiedLinkError: C:\Windows\System32\jmvfw.dll: Can't find dependent libraries
      at com.sun.media.JMFSecurityManager.loadLibrary(JMFSecurityManager.java:206)
      at com.sun.media.protocol.vfw.VFWCapture.<clinit>(VFWCapture.java:19)
      at com.sun.media.protocol.vfw.VFWSourceStream.doConnect(VFWSourceStream.java:241)
      at com.sun.media.protocol.vfw.VFWSourceStream.run(VFWSourceStream.java:763)
      at java.lang.Thread.run(Thread.java:662)


Regards
Which version JMF are you running?
JMF2.1.1e

Regards
You need to look in JMF registry to see which video capture devices are available.
Ok. I will check and confirm.

Regards
Dear krakatoa,
It is YUV Video Format

Regards
I don't get that error when I run your code. For me the webcam runs fine and showing in your app. Are you sure you changed the line of your code to handle yuv?
I would say that a DLL is missing from your System file, as the error report says. Look for C:\Windows\System32\jmvfw.dll in your system somewhere.
the jmvfw.dll is present in system32 still I am facing the same problem. In net it is sugested to install jre 32 bit and not 64 bit. I am not sure whether it will solve the problem or further escalate to other.

Regards
That was something I was going to suggest also. Best if you can try it on another machine - which in a sense you already have, since I have run it successfully.
No Krakatoa. I do not have any other machine ufortunately. But I think it's time to take risk to go for that if no other option left.

Regards
I am not an OS person, but it would surprise me if there were no way to enforce 32-bit mode, if not per-app, then system-wide. It could be worth opening another Q here in the Operating System TA about that. In the meantime, I will do a bit more research myself.
Ok, I will do that. Let me first install JRE 32 bit and try. Let's se what it results. Other wise we may revert back.

Regards
Dear krakatoa,

Good news to say that we have achieved to capture photo. I have uninstall JRE 64 bit and install 32 bit. I am really happy to say that without your help it could not happen. I am still keeping the issue open because there are still some issue to resolve.

Regards
MILIND_JOG, yes, I know those posts. I was not convinced 100%, (which means no more than I hesitated to mention them as it didn't look as if it would resolve your issue without compromise). But this seems the most likely reason at the moment, and relatively unsatisfactory in any case.

I just posted the above, and then saw your latest post. That's good. At the very least it shows that your code is good, which is the most important thing of course.
Thanks Krakatoa. We will again discuss tomorrow. I hope you wouldn't mind.

It's 11:30PM India time. Good nitght. See you tomorrow.

Bye for now.

Thanks & Regards

Milind
As I said in a previous comment, there is a very high likelihood that 32 bit can be configured for 64 environment. The key may be in where the 32-bit libraries are then meant to reside.
Dear Krakatoa,

I am trying to occomadate the media output in a small panel size. The image is not shrinking. I have tried a lot by putting efforts in the dark. Will you please help.

Regards
ASKER CERTIFIED SOLUTION
Avatar of krakatoa
krakatoa
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear krakatoa,
I would like to make more clearity. When ever I execute the java program, it displays the video stream on screen with designed optimum size. When I capture, the image gets saved in .jpg file.

The main issue is resolved to get stream and capture the image. I want to implement it in my main application form. The size designated to this image screen is too less and the issue is to fit the streaming image on that without compromizing on image view. I am unable to shring the streaming video size.

The original issue is resolved. If you advice, I can close this issue and open another as a fresh issue.

Regards
Dear krakatoa,

Thanks for resolving my issue. I am closing this request and opening another. Please help.

Thanks a ton for helping.

Regards

Milind Jog
1.
it displays the video stream on screen with designed optimum size
<1> So the size of the streaming vid display is fine. Tick.

2.
When I capture, the image gets saved in .jpg file.
<2> And now you have your snapshot in a file. Tick.
 
3.
The size designated to this image screen is too less and the issue is to fit the streaming image on that without compromizing on image view.  I am unable to shring the streaming video size.
<3> This comment I do not understand, in light of your two comments above, where everything seemed to be satisfactory. Cross.
ok. thankx.
Dear krakatoa,
I have raised fresh question for the same. Please help.

Regards
If I could I would - unfortunately I do not have any useful experience with video, and I imagine there is going to be a requirement for some manipulation of the image, which I am not versed in. Sorry about that.
Ok Krakatoa. Thanks for response. I will see some other option.

Regards

Milind
Yesss. I will go through this. It is a great help for me. I will come back to you once I go through these link.

Regards
This - although I think it is for an applet - seems to have code in it which is tackling the issue and how the container renders the image concerning size. Even if the code is not directly useful, it looks - at a glance - as if it has useful concepts about what you should be doing. ;)

Oops, nearly forgot the link :

http://jcs.mobile-utopia.com/jcs/64912_MediaPlayer.java