|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.util.media.MovieEncoder
public class MovieEncoder
Usage of this class depends on the existence of the Java Media Framework (JMF) which can be acquired from javasoft.com. The class was tested on JMF 2.1.1.
This class encodes BufferedImages into quicktime movies. It has three main functions:
First, you call getEncodingFormats(), which returns an array of available formats. You specify a frame rate and a prototypical image.
Then, you call the constructor -- specify the frame rate, file, an encoding format chosen from the array in getEncodingFormats, and again provide a prototypical image. You'll want to ensure that future images encoded into the MovieEncoder will have the same size and format as the prototype image. If not, they'll be converted and cropped accordingly, which will take more time. You should expect the constructor to take a few seconds to start up -- JMF is not speedy.
Then you drop images into the MovieEncoder to add to the Quicktime movie as frames, using the add(BufferedImage) method. If there was an error and the movie could not be written, this method (and all subsequent add(...) calls) will return false.
When you're all finished, you call the stop() method to clean up and complete writing the file.
Note: Sun's JMF spawns threads in the background which it never cleans up. Thus if you use this class, you'll need to call System.exit(0) to quit your program rather than just dropping out of main().
Constructor Summary | |
---|---|
MovieEncoder(float frameRate,
java.io.File file,
java.awt.image.BufferedImage typicalImage,
Format encodeFormat)
Creates an object which will write out a move of the specified format, and written to the provided file. |
Method Summary | |
---|---|
boolean |
add(java.awt.image.BufferedImage i)
Adds an image to the movie. |
void |
controllerUpdate(ControllerEvent evt)
Controller Listener. |
void |
dataSinkUpdate(DataSinkEvent evt)
Event handler for the file writer. |
static Format[] |
getEncodingFormats(float fps,
java.awt.image.BufferedImage typicalImage)
Returns null and prints an error out to stderr if an error occurred while trying to get the formats |
boolean |
stop()
Stops the writer and finishes uprocessor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MovieEncoder(float frameRate, java.io.File file, java.awt.image.BufferedImage typicalImage, Format encodeFormat)
Method Detail |
---|
public static Format[] getEncodingFormats(float fps, java.awt.image.BufferedImage typicalImage)
public void controllerUpdate(ControllerEvent evt)
public void dataSinkUpdate(DataSinkEvent evt)
public boolean add(java.awt.image.BufferedImage i)
public boolean stop()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |