• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Media Framework - How to capture screen activity?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have to capture video desktop activity (including audio) to a file using JMF. I spent hours and hours searching this... a have studied a lot of classes, examples BUT I don't know how to bind them... how to record the actvity. My project is to record screen activity, upload on a server and finally control my computer remotely from an applet (or from another java desktop application).

Can someone show me some hints or code for modifying JVidCap example from Sun? Someone else on Sun forum said he could do it but did not say how...

I just want to modify the video capturing so that I get the screen actifity recorded. I read nearly all examples possible including Screen Grabber...

Please help me!


This is the capturing class in the example:


I also have two classes to get the screen activity as datasource... but I really don't understand how to implement them in my application because there is no method returning a datasource object...

This captures the frames using a Robot and feeds them to DataSource class:

Sorry I posted 3 big classes but I hope someone can bind them or help me to go on on this project.... it is so important to me ...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt that JMF contains much that would help with this. Note that the JVidCap example you linked to captures video from a camera (or video card), not from the desktop.

The java.awt.Robot.createScreenCapture method can create snapshots of the screen; that may be a starting point.
 
claudiu teodorescu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already used screenshots with Robot and send them as byte arrays using sockets but the framerate is to little, so I wanted to capture my screen as video file and stream it to the client using HTTP... first I want to record the screen to a video file. I tried this but the video file is 0 bytes... Don't know why. Hre is the code: I used DataSource and LiveStream example classes (LiveStream feeds the DataSource with screenshots using a Robot). I renamed DataSource to CDataSource and passed the MediaLocator to is


Why is that file 0 bytes? something wrong with datasink?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting; I stand corrected. Did you get Sun's ScreenGrabber example to work? It seems to do pretty much what you're looking for.
 
claudiu teodorescu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well... I try make it work but looks like the file is 0 bytes lenght.... something is wrong with recording...
 
claudiu teodorescu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally I could recod the video and the sound. The file was 0 bytes length cause I didn't close the processor and datasink because my WindowClose event was not working properly.
Note: I use LiveStream and DataSource classes from ScreenGrabber example from Sun AND I renamed DataSource to CDataSource (because it was confusing for netbeans IDE) + I passed the MediaLocator in the constructor of CDataSource class so, in that class you must modify this:

This is the main class (don't forget to select the right recording device of your soundcard). I post it for everyone trying to do this
Enjoy my code

 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic