"I Think, I Conceptualize, I Analyze, I Design, and I Create." ~ Puneet Kalra

Cognitive Robotics Research Centre Of University Of Wales, Newport Puneet Kalra

Home Studies Research Projects Tutorials Portfolio

Puneet Kalra - www.puneetk.com - Socializing Robots

Video Capturing In Java Using JMF

February 7th, 2010 by Puneet Kalra Leave a reply »

Hello Everyone,

I’m back with something new, while exploring Java and this time the API is : Java Media Framework (JMF).

Well this time I’m going to share how you can create Video Capturing Application Or you can say a Webcam in Java using JMF API.

Here’s a cap :
Cap Of Video Capturing Application Created In Java

No more words and without wasting more time. Lets get to the main point.

Here’s the code :  Click Here
Comments on all main lines of code are provided in file.

More to come soon!..

23 Responses

  1. kishor says:

    hii
    i see ur code but i want some modification in that code
    i want video capturing and save to a file for every 10 seconds but in hidden

  2. Jatish Khanna says:

    Yes you can do it by using sleep(10000);

    Use a loop until the capturing is going and use delay of 10sec [ sleep(10000) ] and put the saved file to where JAVA is Installed. [ ../bin ] + use the save method in that fx()……

  3. Ankita bhutra says:

    we r also makng this project but facing many problems
    can u pls help us nd share some ideas regardng this topic
    hw we can do chat in real time…
    plsssss help us
    its our minor project othr wise our hod is gong to kill us

  4. Puneet Kalra says:

    Hey Ankita,

    Sorry for late reply,
    We’ll discuss it on Facebook as i have accepted your friend req. already.

    Regards

  5. George Adams says:

    Hi,
    I installed JMF. Where I can get the javax.media.* library?

  6. imal hasaranga says:

    Hey friend i run this code.. but it gives

    java.lang.NullPointerException
    at newpackage.MyCam.(MyCam.java:42)
    at newpackage.MyCam.main(MyCam.java:75)

    error..
    i dont know y, i properly connected my cam also

  7. piyush soni says:

    hi………
    i want to make project on face recognition
    could u please help me that how to use jmf for face recognition……..???????????

  8. imal hasaranga says:

    Hey guys i managed to fix it… u’ll have to configure jmf studio to list the capture devices…

  9. bhanu says:

    great work guys……………

  10. AddKluziv says:

    I am also a computer science student but pursuing my diploma from Center for Computers and Communication Technology, Chisopani, South Sikkim. I was really happy to see the code. I don’t know whether it may run or not, but I am heartily thankful to Puneet for his contribution to my knowledge.

  11. mohit singhal says:

    hello sir i have taken a project to capture a video through webcam i read your code .when i run this code i m facing

    java.lang.NullPointerException
    at mycam.MyCam.(MyCam.java:42)
    at mycam.MyCam.main(MyCam.java:75)
    this error.
    i am working on window vista.please give me guide because i have to submit this project in one week please sir help me.
    mohit singhal

    • dev says:

      ok…i got soln…i m also facing same prob…null pointer exception at 45,73,41,74…this happens when u don’t configure ur video device through jmf registory….there firstly u have to go on setting optins->and then on capture device….if result came with vfw etx. i.e video for windows….then it rely that u can now run ur jmf program normally…otherwise….did same..at jmf registory….select cature devices….thnx :)

  12. Fatema Mohsen says:

    Hi Puneet,
    Thanks for your post, but i am also getting the error java.lang.NullPointerException
    at MyCam.(MyCam.java:40)
    at MyCam.main(MyCam.java:73)
    Can you help me about that plzz?

    • madhav says:

      The problem u might be facing is because jmf works fine with a 32 bit jdk.. so be sure u are using a 32 bit java..

      I also tried running the prog with a 64 bit java and found the same error…

      I studied the code and found that the statement at line 30 does not get executed.. that means that there is problem with the capture device manager class.. I dont have the solution … if any one gets it pls reply..

  13. Manivannan says:

    Hi Puneet,
    Thanks for your post,Its Working.i need to watch video stream and also record this video simultaneously.please help me and guide me..And also i need your help for to make internet calling to phone using java

  14. Harry says:

    Hii Thanx For the code it worked vary well…Now i want that there should a click button and when i click on This button the current image on webcam should be stored in the database .Plzz help me i need it for my project

  15. Harry says:

    Hi Puneet Thanx For the code it worked very well…Now i want that there should a click button and when i click on This button the current image on webcam should be stored in the database .Plzz help me i need it for my project

  16. Harry says:

    Hii Can u plzz tell me how to display the live video on my webpage .I am using eclipse IDE. Thanks

  17. raj says:

    i m using window7 32bit

    locator = cam.getLocator();
    it return NullPointerException at run time

    java.lang.NullPointerException
    at MyCam.(MyCam.java:40)
    at MyCam.main(MyCam.java:73)

  18. kayal says:

    i need coding for capturing image using jmf software

Trackbacks/
Pingbacks

  1. hWinetst
  2. bvesnie
  3. vgteslle

Leave a Reply

Please note : I will help you only if you will show some efforts! Don't expect replies to simple queries, You can easily find answers for them through searching.

I'm a student and I work as well. So i might reply late here. If you have something important to discuss Or stuck somewhere in your project. Please post on my Facebook page for a quick response.