JMF Webcam help

I'm interested in getting a usb/firewire camera to capture imagery to be analyzed in real time with some java-based algorithms. After crawling the forums, it seems like most quicktime compatible cameras can be bridged in with QTJava.
My question though: Is there a camera that has a java api for it's actuation? ie- Is there a camera that works with JMF, that also has some sort of driver libraries to control movement? I'd prefer to not rewrite that code just yet, and there were some suggestions in previous threads for people to "write your own driver..."... so who wrote one and what camera do you use :)

hello again guys..
im back here to see if someone has some other advices.. :)
i solved this problem on ubuntu.. but my client said he needs my java application running on Mandriva..
i already did everything i did on ubuntu..but im still cant connect the webcam on my java application..
at jmstudio and jmfregistry the device is found..so..help me.. :)

Similar Messages

  • JAVA + JMF(Webcam) + LINUX (UBUNTU) --HELP

    hello ..
    i have a problem.. i already search on forum a lot..but i couldnt find the solution or something exactly like that..so..i'd like to ask some help over here..
    i already installed jdk..jmf.. jmfregistry detects my webcam without problems.. i can use jmstudio to record some video and at kopete i could use my webcam..
    the great problem is... i have a JAVA program that needs to connect to my webcam and take a picture.. but everytime i run my application i never can detect any device..
    i tryed the device path like.. v4l://0... v4l2://0.. and a lot of others..
    if someone is not familiar with code..
    thats it:
    this.mediaLocator = new MediaLocator("v4l://0");
    somebody can help me?
    sorry my bad english..
    Edited by: fcsa on Mar 6, 2008 4:28 PM

    hello again guys..
    im back here to see if someone has some other advices.. :)
    i solved this problem on ubuntu.. but my client said he needs my java application running on Mandriva..
    i already did everything i did on ubuntu..but im still cant connect the webcam on my java application..
    at jmstudio and jmfregistry the device is found..so..help me.. :)

  • JMF Newbie Help and Dual Webcam

    Hi all,
    I am a new user to JMF and am quite lost with the various examples found on the internet.
    If there is a low-down, without the frills tutorial do point me to it.
    This is the process of my program:
    Selects a webcam
    Saves image (I found solutions for this in omcgovern's post)
    Reselect a webcam.
    The thing is I need to be able to switch webcams as and when I like but the webcam select dialog only appears once.
    And the capture device detection with null doesn't work, so I used a method that I found in another post.
    My code that I'm posting is just a webcam app I modified, to have a start and stop button.
    The start button is supposed to be able to select another web cam.
    Do give me pointers!
    Cheers.
    import javax.media.Player;
    import javax.media.CaptureDeviceInfo;
    import javax.media.MediaLocator;
    import javax.media.CaptureDeviceManager;
    import javax.media.Manager;
    import javax.media.format.*;
    import java.util.Vector;
    import java.awt.*;
    import java.awt.event.*;
    public class Test implements ActionListener {
    CaptureDeviceInfo device;
    MediaLocator ml;
    Player player;
    Component videoScreen;
    public static void main(String args[]){
    new Test();
    Test(){
    try
    { //gets a list of devices how support the given videoformat
    //Vector deviceList = CaptureDeviceManager.getDeviceList();
    // This works but its somewhat hard-coded (Nat)
    // new CaptureDeviceInfo("vfw://0",new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):0"),null);
    // new CaptureDeviceInfo("vfw://1",new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):1"),null);
    // new CaptureDeviceInfo("vfw://2",new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):2"),null);
    device = new CaptureDeviceInfo("vfw://0",new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):0"),null);
    //device = (CaptureDeviceInfo) deviceList.firstElement();
    ml = device.getLocator();
    player = Manager.createRealizedPlayer(ml);
    player.start();
    videoScreen = player.getVisualComponent();
    videoScreen.setBounds(10,10,300,300);
    Button a = new Button("Stop");
    a.setBounds(10,320,75,25);
    a.addActionListener(this);
    Button b = new Button("Start");
    b.addActionListener(this);
    b.setBounds(235,320,75,25);
    Frame frm=new Frame();
    frm.setLayout(null);
    frm.setSize(360,360);
    frm.add(a);
    frm.add(b);
    frm.add(videoScreen);
    frm.setVisible(true);
    catch(Exception e)
    System.out.println(e);
    // My findings on experiments so far.
    // player.stop() and player.start() can be used continuously unless you call player.close();
    // What is the code that pops up the webcam selector??
    public void actionPerformed(ActionEvent e) {
         Button button = (Button)e.getSource();
         if(button.getLabel().equals("Start")) {
              try {
                   device = new CaptureDeviceInfo("vfw://0",new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):0"),null);
                   System.out.println("Test1");
                   ml = device.getLocator();
                   System.out.println("Test2");
                   player = Manager.createRealizedPlayer(ml);
                   System.out.println("Test3");
                   player.start();
                   System.out.println("Test4");
                   videoScreen = player.getVisualComponent();
                   System.out.println("Test");
              } catch(Exception ex) {System.out.println("Start error!");}
         else {
              player.stop();
              player.close();
    }

    You're probably in deep trouble then.... but nothing an investment into a cheap modern web cam couldn't cure...
    Have you checked the Web Cam web site for any updated drivers ?
    Here's a list of supported devices...
    http://java.sun.com/products/java-media/jmf/2.1.1/formats.html#Capturers
    regards,
    Owen

  • Here is the source code to JMF Webcam app + saves jpeg

    Since so many people ask for this code, but never get it, I figured I'd repost it. I didn't write it, but I added the jpeg saving part, and modified it for my device, which you will have to do to get it to work. Just go into JMFRegistry and get the device name from your webcam and then edit the code. Also, keep in mind that some webcams don't work with JMF. You have to have a webcam that supports VFW or WDM interface.
    And here's the code:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    public class SwingCapture extends Panel implements ActionListener
      public static Player player = null;
      public CaptureDeviceInfo di = null;
      public MediaLocator ml = null;
      public JButton capture = null;
      public Buffer buf = null;
      public Image img = null;
      public VideoFormat vf = null;
      public BufferToImage btoi = null;
      public ImagePanel imgpanel = null;
      public SwingCapture()
        setLayout(new BorderLayout());
        setSize(320,550);
        imgpanel = new ImagePanel();
        capture = new JButton("Capture");
        capture.addActionListener(this);
        String str1 = "vfw:Logitech USB Video Camera:0";
        String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
        di = CaptureDeviceManager.getDevice(str2);
        ml = di.getLocator();
        try
          player = Manager.createRealizedPlayer(ml);
          player.start();
          Component comp;
          if ((comp = player.getVisualComponent()) != null)
            add(comp,BorderLayout.NORTH);
          add(capture,BorderLayout.CENTER);
          add(imgpanel,BorderLayout.SOUTH);
        catch (Exception e)
          e.printStackTrace();
      public static void main(String[] args)
        Frame f = new Frame("SwingCapture");
        SwingCapture cf = new SwingCapture();
        f.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
          playerclose();
          System.exit(0);}});
        f.add("Center",cf);
        f.pack();
        f.setSize(new Dimension(320,550));
        f.setVisible(true);
      public static void playerclose()
        player.close();
        player.deallocate();
      public void actionPerformed(ActionEvent e)
        JComponent c = (JComponent) e.getSource();
        if (c == capture)
          // Grab a frame
          FrameGrabbingControl fgc = (FrameGrabbingControl)
          player.getControl("javax.media.control.FrameGrabbingControl");
          buf = fgc.grabFrame();
          // Convert it to an image
          btoi = new BufferToImage((VideoFormat)buf.getFormat());
          img = btoi.createImage(buf);
          // show the image
          imgpanel.setImage(img);
          // save image
          saveJPG(img,"c:\\test.jpg");
      class ImagePanel extends Panel
        public Image myimg = null;
        public ImagePanel()
          setLayout(null);
          setSize(320,240);
        public void setImage(Image img)
          this.myimg = img;
          repaint();
        public void paint(Graphics g)
          if (myimg != null)
            g.drawImage(myimg, 0, 0, this);
      public static void saveJPG(Image img, String s)
        BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = bi.createGraphics();
        g2.drawImage(img, null, null);
        FileOutputStream out = null;
        try
          out = new FileOutputStream(s);
        catch (java.io.FileNotFoundException io)
          System.out.println("File Not Found");
        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
        JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
        param.setQuality(0.5f,false);
        encoder.setJPEGEncodeParam(param);
        try
          encoder.encode(bi);
          out.close();
        catch (java.io.IOException io)
          System.out.println("IOException");

    Hi William,
    I've tried this code but I always get an null fgc with the following line.
    FrameGrabbingControl fgc = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingCotrol");
    So the player returns always null. The other thigns seem to be fine. I can view the image in the application but when I click capture it throws a Null Pointer Exception because fgc is null.
    I am using Logitech QuickCam, USB, Win2k, jdk 1.3.1, JMF 2.1.1
    Can you help me?
    thanx,
    Philip
    Since so many people ask for this code, but never get
    it, I figured I'd repost it. I didn't write it, but I
    added the jpeg saving part, and modified it for my
    device, which you will have to do to get it to work.
    Just go into JMFRegistry and get the device name from
    your webcam and then edit the code. Also, keep in mind
    that some webcams don't work with JMF. You have to
    have a webcam that supports VFW or WDM interface.
    And here's the code:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    public class SwingCapture extends Panel implements
    ActionListener
    public static Player player = null;
    public CaptureDeviceInfo di = null;
    public MediaLocator ml = null;
    public JButton capture = null;
    public Buffer buf = null;
    public Image img = null;
    public VideoFormat vf = null;
    public BufferToImage btoi = null;
    public ImagePanel imgpanel = null;
    public SwingCapture()
    setLayout(new BorderLayout());
    setSize(320,550);
    imgpanel = new ImagePanel();
    capture = new JButton("Capture");
    capture.addActionListener(this);
    String str1 = "vfw:Logitech USB Video Camera:0";
    String str2 = "vfw:Microsoft WDM Image Capture
    ure (Win32):0";
    di = CaptureDeviceManager.getDevice(str2);
    ml = di.getLocator();
    try
    player = Manager.createRealizedPlayer(ml);
    player.start();
    Component comp;
    if ((comp = player.getVisualComponent()) !=
    )) != null)
    add(comp,BorderLayout.NORTH);
    add(capture,BorderLayout.CENTER);
    add(imgpanel,BorderLayout.SOUTH);
    catch (Exception e)
    e.printStackTrace();
    public static void main(String[] args)
    Frame f = new Frame("SwingCapture");
    SwingCapture cf = new SwingCapture();
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    playerclose();
    System.exit(0);}});
    f.add("Center",cf);
    f.pack();
    f.setSize(new Dimension(320,550));
    f.setVisible(true);
    public static void playerclose()
    player.close();
    player.deallocate();
    public void actionPerformed(ActionEvent e)
    JComponent c = (JComponent) e.getSource();
    if (c == capture)
    // Grab a frame
    FrameGrabbingControl fgc =
    fgc = (FrameGrabbingControl)
    player.getControl("javax.media.control.FrameGrabbingCo
    trol");
    buf = fgc.grabFrame();
    // Convert it to an image
    btoi = new
    = new BufferToImage((VideoFormat)buf.getFormat());
    img = btoi.createImage(buf);
    // show the image
    imgpanel.setImage(img);
    // save image
    saveJPG(img,"c:\\test.jpg");
    class ImagePanel extends Panel
    public Image myimg = null;
    public ImagePanel()
    setLayout(null);
    setSize(320,240);
    public void setImage(Image img)
    this.myimg = img;
    repaint();
    public void paint(Graphics g)
    if (myimg != null)
    g.drawImage(myimg, 0, 0, this);
    public static void saveJPG(Image img, String s)
    BufferedImage bi = new
    new BufferedImage(img.getWidth(null),
    img.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = bi.createGraphics();
    g2.drawImage(img, null, null);
    FileOutputStream out = null;
    try
    out = new FileOutputStream(s);
    catch (java.io.FileNotFoundException io)
    System.out.println("File Not Found");
    JPEGImageEncoder encoder =
    r = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam param =
    m = encoder.getDefaultJPEGEncodeParam(bi);
    param.setQuality(0.5f,false);
    encoder.setJPEGEncodeParam(param);
    try
    encoder.encode(bi);
    out.close();
    catch (java.io.IOException io)
    System.out.println("IOException");

  • Video stream recording (not webcam) help required

    I am making a media player / recorder type web application in flex 4.
    The application plays video streams streamed from my red5 server.
    I want to give users the ability to make / record clips of the video they are viewing.
    I know that netstream.publish is used to record/save video on the server.
    All the help i've found on google so far just give examples to save video from webcam.
    But i want to save video from a video being streamed from red5 server and being played
    on VideoPlayer control in flex.
    All help is greatly appreciated.
    Thanks.

    Thanks for the reply but i think u misunderstood my problem.
    I am not receiving any RTP Stream but RTMP stream.RTMP is a proprietary protocol of Adobe For Streaming Flash video from Flash Media Server (FMS).
    I again state the problem.
    I am getting an RTMP Stream now i want to convert it into an RTP Stream so that i can process or transmit it further.I want to convert this RTMP Stream to RTP format.
    Anyone plz help me out.I am stuck into this for past 2 days and it is very critical for my project. :-(

  • Urgent webcam help needed please

    i didnt know where else to put this post. Anyway i just got a logitech fusion webcam which they sell on the apple store. i plugged it in and set it up. whenever i speak to anyone on skype(its the only one i use). they always say that around every 20 seconds they get a noise their end that sounds like wind noise. ive opened up the sound box in preferences and can see it happening form the noise indicator. but dont know what it is or how to stop it.. any ideas i really need help.. thanks in advance. the webcam by the way has a built in mic and i have the output coming through my speakers. ive also moved the speakers away from the webcam in case of interference but no joy.. please help..

    Hi-
    Checking the Skype forums reveals a concensus that the problem is most likely within the Skype software.
    http://forum.skype.com/index.php?s=6b9ae6327268168f5c1291d17df06400&showforum=15
    Some suggest disabling the mic, and using a seperate mic. This is because some believe the hardware combo (camera/mic) over USB is the problem. Others suggest using the macam driver. Others still, claim there was no noise before 2.5. There are even problems with the Windows version, apparently.
    A new Skype for Mac beta was released today- 2.7. You can download it from the following link:
    http://forum.skype.com/index.php?act=announce&f=15&id=38
    Would be adviseable to report the current bug to Skype. Include all system details, software and OS versions. The more people that report the problem, the sooner a fix will come about.

  • Webcam Help

    Hi, I have a Flash file which shows a webcam and takes a snapshot, Currently the webcam display is set to 320px x 240px and take a snapshot of that video.
    I have tried to scale up the webcam size and document size to get a better quality but the webcam just stays to 320 x 240 and sits in the top left corner.
    var cam:Camera = Camera.getCamera();
    cam.setQuality(bandwidth, quality);
    cam.setMode(320,240,30,false); // If I change this it seems for example to 640 x 480 it just stays at the 320 x 240 and sits in the top left, how can I make it bigger.
    var video_vobj:Video = new Video();
    video_vobj.attachCamera(cam);
    and var picture:BitmapData = new BitmapData(320, 240);
    picture.draw(video_vobj);
    So what am I doing wrong how can I make the webcam bigger
    Also would it be possible to detect the largest possible resolution for the webcam and somehow use that?
    Thanks - James

    Have you tried doing a System Restore back to a time when it did work?
    It wouldn't hurt, and if that doesn't help you can restore it back to today when you are done.
    Good luck,
    Larry...

  • Wireless Card & Webcam HELP!! (dv9620us)

    Hi!
    I have a HP Pavilion DV9620us.  Operating system is Windows Vista Home Premium (64-bit).  Basically, the jist is that my sister had upgraded (terribly at that) it to Windows 7.  Since then nothing but problems!!  Sound would occasionally come in and out, webcam doesn't work and even Wi-Fi crashed on me.  Only way was via an external USB adapter.
    Anyhow, didn't have recovery discs (also another long story).  Well, now after reading and seeing all the little quirks this device had with others who switched to Win 7, I opted to go back to my original Windows Vista Home Premium.  It's like a brand new computer, everything seems to work like a charm. 
    I got the sound and mic to work.  It's running smoothly.  No crashing.  No overheating.  Even the power and battery work well.  However,  I cannot get the comp to detect the Webcam (it's not even an option/listed in Device manager) and neither is the wifi adapter card.
    I need help with both of these.  Especially with the the wifi.  (I got everything else including LightScribe to work fine). 
    Would removing the card and reinstalling work?  If not, what card should I buy to replace it with?  (I do know how to do these things and am not happy having to use a usb network adapter)
    I also installed the Suyin Crystal Eye webcam software, but the laptop still doesn't detect it.  It's not major since I never use it, but would love help with the wifi!
    Thanks!!!
    This question was solved.
    View Solution.

    Hi:
    If you don't see the wlan card in the device manager at all (either as a network controller needing drivers, or listed under the network adapters section), then more than likely the motherboard power to the mini-PCIe slot has failed which is a very common issue with that model (along with other motherboard failures (video, audio and power to the dvd).
    You can try removing and reseating the wlan card-- you have nothing to lose by trying but don't get your hopes up.
    Did you install the Cyberlink YouCam software?  That should be all you need to get the webcam to work.
    If you have, you can chalk the webcam up to motherboard failure too.

  • Presario CQ56-115DX Webcam Help

    I'm pretty sure that this model doesn't have a built-in webcam in it. It has a spot at the top for one, right next to the microphone hole. My question is, can I buy the webcam separately and put it in, or ship it off to HP to have it put in for me (sonce it has the spot at the top for one)? I love this laptop and would really like to have a webcam built into it, instead of having to deal with the hassle of carrying around an external one.

    The option to add webcam is available only for CTO models where notebooks are customized  while ordering directly from HP. I dont think you can send it to HP  to add webcam.
    I guess this thread over here will answer your question better. If you really want to add a webcam by yourself, if you open display assembly of your laptop, the (7) part is nothing but your webcam.
    If you have some knowledge about a laptop disassembly. The Service Manual is available over here and Part# for your webcam module would be 626656-001 which you can order and add it on your computer by yourself or taking the notebook to a local technician.
    //Click on Kudos and Accept as Solution if my reply was helpful and answered your question//
    I am an HP employee!!

  • X220 Tablet - Integrated Webcam Help

    Hello, I am trying to use my integrated webcam, but I think I never installed the driver? Can someone lead me to the correct dirver dl?
    Thanks!

    Hi, Maryd1621
    What exactly happens when you attempt to use the integrated camera? Which programs have you tried using the camera with? As for the driver, click here for the camera driver for Windows 7, Vista, and XP. If you are using Windows 8, there is not an updated driver on the website, but the default driver built in to the machine should work fine.
    Hope it helps,
    Adam
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution!" This will help the rest of the community with similar issues identify the verified solution and benefit from it.

  • EeePC 900 webcam help

    I have an eeePC 900 with linux linpus lite installed, and am not sure how to use the webcam.
    How would I go about using it? There is obviously a webcam on it, but it has a plastic shield over it; I would think that this is a cover that the camera can see through, as I havent figured out how to get it off. There isn't a settings icon for the webcam or anything, either.
    If this were using a 'conventional' linux, I would just download a little fix to use the cam. Well, this not exactly being a 'conventional' linux distro, so I can't do that, that I know of, so I'm stuck
    Any help or referral would be perfect, and thanks in advance

    Hello Zopiac!
    I have not had the opportunity to try either that computer or that linux distro, yet.  I just wanted to make sure you got an answer, if so, could you like to share that with us? Anyone else familiar with the answer to this question?
    Matthew|Community Advocate | Best Buy® Corporate
    Visit our Channel on
     Private Message

  • Compaq 2710p Webcam Help.

    HI. can you help me set-up my webcam for HP Compaq 2710p? Thanks!
    This question was solved.
    View Solution.

    Hi,
    The following manual may help:
       http://h10032.www1.hp.com/ctg/Manual/c01455314.pdf
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • TrueVision HD Webcam help

    I have an Ultrabook Envy with a TrueVision HD built in webcam. Recently, I haven't been able to turn on the web cam at all. For example, skype tries to turn it on but it constantly makes the USB port plugging in and out sounds while the camera rapidly turns on and off with no image. I've tried disabling the USB Root Hubs and restarting and then enabling then (what I thought was the equivilant of plugging in and out for internat devices) but had no luck. 
    Any other ways I could fix this problem with my webcam? 
    Thank you for any suggestions you have!

    Hello @Caliginosity,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that you have not been able to power on the webcam for your notebook computer, and that disabling the USB Root Hubs does not resolve this. Was there a point in time when the webcam was working? Did you install any new software to your computer recently? I would be happy to help you, but first I would encourage you to post your product number for your computer. Below is a is an HP Support document that will demonstrate how to find your computer's product number. In addition, it will also help if you indicate which operating system you are using; and whether your operating system is 32 or 64 bit. The more information you can provide, the better!
    How Do I Find My Model Number or Product Number?
    Which Windows operating system am I running?
    Is the Windows Version on My Computer 32-bit or 64-bit?
    Please re-post with the necessary information, this way I will be able to research this further for you. I look forward to your reply!
    Cheers! 
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Dynex Webcam Help PLEASE!

    I just purchased a Dynex DX-WEB1c webcam and it states that it is mac compatable, but I have no idea how to get it to work. The CD does not run or install. We are stuck, please help!

    The CD is for Windows machines and contains driver for same. Have you read the guide?
    http://www.dynexproducts.com/skins/skin1/Topics/Documents/DX-WEB1C_CPW%20QSG_08-1757WEB.pdf
    Particularly the note regarding Mac compatibility?
    Have you contacted the vendor?
    Why would you need a web cam with your MBP?

  • Opening Webcam Help...

    I'm new to Mac, coming from a PC laptop for years. How do I find my webcam program and open it to start using it?

    Hey Zach and welcome to the forum -
    Do you mean Photo Booth? It's one of your Applications. Open Finder and click on Applications on the left column the goto Photo Booth in that folder.
    Hope this helps - GDF

Maybe you are looking for