No results found

Your search did not match any results.

We suggest you try the following to help find what you’re looking for:

  • Check the spelling of your keyword search.
  • Use synonyms for the keyword you typed, for example, try “application” instead of “software.”
  • Try one of the popular searches shown below.
  • Start a new search.
Trending Questions

Screen Grabber [DataSource]

JMF Solutions


How to capture the contents of the screen and feed it to a JMF player or Processor for purposes such as saving screen shots to disk or transmitting live using RTP.


Java 2 v.1.3 introduced a new class, java.awt.Robot, that provides screen capture facilities. Since this is similar to capturing video from a VCR or camera, it is best encapsulated in a JMF DataSource object. This example shows how to use Robot to create a screen capture DataSource.

The DataSource is a PushDataSource that pushes captured screen shots at regular intervals to the connected Player or Processor. It creates a new protocol "screen" with the following URL syntax:


where x, y specify a screen location and width,height specify the size. fps specifies the number of frames to push per second. This can be any fraction greater than zero, although realistic values would be between 0.1 and 30.0.

For example, to capture screen activity in the center of a 1024x768 screen, use


Note: This program requires JDK 1.3 or higher to compile and to run.


Platform: JDK 1.3 or later
JMF API: 2.0 or later
Implementation: AJ, WPP, SPP *

* AJ = All Java, WPP = Windows Performance Pack, SPP = Solaris Performance Pack

Related Classes

  • java.awt.Robot

How to run this sample

  1. Compile the DataSource and LiveStream classes:
    javac -d .
  2. Run using JMStudio:
    java JMStudio screen://0,0,160,120/10

Source Code