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!..

29 Responses

  1. 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. 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. 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. 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

  5. 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.

  6. 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

    1. 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 🙂

  7. 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?

    1. 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..

  8. Pingback: hWinetst
  9. Pingback: bvesnie
  10. Pingback: vgteslle
  11. 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

  12. 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

  13. 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

  14. 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)

  15. Hey I tried your code. It let me to switch on my camera and I can see the picture. But I can not understand ho to capture image through it. Can you help me???????

  16. is it possible to record video/audio without xuggler/ffmpeg/server side in java applet. I cannot use xuggler as it has 40 mb and takes tool long time for loading

Leave a Reply

Your email address will not be published. Required fields are marked *


Notice: Use of undefined constant STOPSPAM_PLUGIN_VERSION - assumed 'STOPSPAM_PLUGIN_VERSION' in /home/webpilla/puneetk.com/wp-content/plugins/stop-spam/stop-spam.php on line 36

Notice: Use of undefined constant STOPSPAM_PLUGIN_VERSION - assumed 'STOPSPAM_PLUGIN_VERSION' in /home/webpilla/puneetk.com/wp-content/plugins/stop-spam/stop-spam.php on line 40