JMF example programs

On this page are some sample JMF programs each of which is written as a Java applet. In each case there is a link to the html file to run the applet as well as a link to the Java source code itself for viewing and downloading.

The functionality of each of the applets is trivial but the kind of video processing carried out in each case is typical of the sort of thing researchers want to do - read from a movie file, perform some processing and put the processed frame back into the video stream to display along with the original. The input and output processors are synchronised with the input being the master controller. Also interaction with a GUI component (in this case a slider bar to set a threshold) is included in the application. Typically an example will either use just the current frame or the current and buffered  previous frames to produce the current output frame  (such as, for example, computing frame difference).


Example 1. Frame thresholding

The program displays both the original frame and the thresholded frame within a JInternalFrame which is added to the applet container. The threshold value can be selected with a slider.

To run the applet click on Movie frame threshold applet

To view/download the source code click on MovieFrameThresholdApplet.java

Example 2. Frame difference thresholding

As above but this program thresholds the frame difference (by buffering the previous frame) so that only moving regions are highlighted.

To run the applet click on Movie frame difference applet

To view/download the source code click on MovieFrameDifferenceApplet.java

Example 3. Displaying individual colour channels

In this program, indiviudal R,G,B,Y,U or V channels can be displayed along with the original sequence.

To run the applet click on Colour channel select applet

To view/download the source code click on MovieFrameRGBtoYUVApplet.java


NOTE 1. To run JMF in an applet can be a bit fiddly. If you get a java.lang.NoClassDefFoundError it means that you probably installed your current jre after you installed JMF. In this case you need to manually copy the jmf.jar file to the <JDK>/jre/lib/ext directory being sure to check that this jre is the one called by your browser's plug-in! (You do this by selecting the 'Java Plug-in' icon from the control panel and then select the 'Advanced' tab which will enable you to point your browser at whichever jre you like).

NOTE 2. There are a more extensive set of JMF programs on Sun's  JMF Solutions page.