AVIWriter
instead of this class.public class AVIOutputStreamOLD
extends java.lang.Object
The images are written as video frames.
Video frames can be encoded with one of the following formats:
All frames in an AVI file must have the same duration. The duration can
be set by setting an appropriate pair of values using methods
setFrameRate(int)
and setTimeScale(int)
.
The length of an AVI 1.0 file is limited to 1 GB. This class supports lengths of up to 4 GB, but such files may not work on all players.
For detailed information about the AVI RIFF file format see:
msdn.microsoft.com AVI RIFF
www.microsoft.com FOURCC for Video Compression
www.saettler.com RIFF
Modifier and Type | Class and Description |
---|---|
static class |
AVIOutputStreamOLD.AVIVideoFormat
Deprecated.
Supported video formats.
|
Constructor and Description |
---|
AVIOutputStreamOLD(java.io.File file,
AVIOutputStreamOLD.AVIVideoFormat format)
Deprecated.
Creates a new AVI file with the specified video format and
frame rate.
|
AVIOutputStreamOLD(java.io.File file,
AVIOutputStreamOLD.AVIVideoFormat format,
int bitsPerPixel)
Deprecated.
Creates a new AVI file with the specified video format and
frame rate.
|
AVIOutputStreamOLD(javax.imageio.stream.ImageOutputStream out,
AVIOutputStreamOLD.AVIVideoFormat format)
Deprecated.
Creates a new AVI output stream with the specified video format and
framerate.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes the movie file as well as the stream being filtered.
|
void |
finish()
Deprecated.
Finishes writing the contents of the AVI output stream without closing
the underlying stream.
|
int |
getFrameRate()
Deprecated.
Returns the frame rate of this media.
|
int |
getTimeScale()
Deprecated.
Returns the time scale of this media.
|
float |
getVideoCompressionQuality()
Deprecated.
Returns the video compression quality.
|
java.awt.Dimension |
getVideoDimension()
Deprecated.
Gets the dimension of the video track.
|
void |
setFrameRate(int newValue)
Deprecated.
Sets the rate of video frames in time scale units.
|
void |
setPalette(java.awt.image.IndexColorModel palette)
Deprecated.
Sets the global color palette.
|
void |
setTimeScale(int newValue)
Deprecated.
Used with frameRate to specify the time scale that this stream will use.
|
void |
setVideoCompressionQuality(float newValue)
Deprecated.
Sets the compression quality of the video track.
|
void |
setVideoDimension(int width,
int height)
Deprecated.
Sets the dimension of the video track.
|
void |
writeFrame(java.awt.image.BufferedImage image)
Deprecated.
Writes a frame to the video track.
|
void |
writeFrame(java.io.File file)
Deprecated.
Writes a frame from a file to the video track.
|
void |
writeFrame(java.io.InputStream in)
Deprecated.
Writes a frame to the video track.
|
public AVIOutputStreamOLD(java.io.File file, AVIOutputStreamOLD.AVIVideoFormat format) throws java.io.IOException
file
- the output fileformat
- Specifies the video format.java.lang.IllegalArgumentException
- if videoFormat is null or if
frame rate is <= 0java.io.IOException
public AVIOutputStreamOLD(java.io.File file, AVIOutputStreamOLD.AVIVideoFormat format, int bitsPerPixel) throws java.io.IOException
file
- the output fileformat
- Selects an encoder for the video format.bitsPerPixel
- the number of bits per pixel.java.lang.IllegalArgumentException
- if videoFormat is null or if
frame rate is <= 0java.io.IOException
public AVIOutputStreamOLD(javax.imageio.stream.ImageOutputStream out, AVIOutputStreamOLD.AVIVideoFormat format) throws java.io.IOException
out
- the underlying output streamformat
- Selects an encoder for the video format.java.lang.IllegalArgumentException
- if videoFormat is null or if
framerate is <= 0java.io.IOException
public void setTimeScale(int newValue)
The default value is 1.
newValue
- public int getTimeScale()
public void setFrameRate(int newValue)
The default value is 30. Together with the default value 1 of timeScale this results in 30 frames pers second.
newValue
- public int getFrameRate()
public void setPalette(java.awt.image.IndexColorModel palette)
public void setVideoCompressionQuality(float newValue)
Changing this value affects frames which are subsequently written to the AVIOutputStreamOLD. Frames which have already been written are not changed.
This value has only effect on videos encoded with JPG format.
The default value is 0.9.
newValue
- public float getVideoCompressionQuality()
public void setVideoDimension(int width, int height)
You need to explicitly set the dimension, if you add all frames from files or input streams.
If you add frames from buffered images, then AVIOutputStreamOLD can determine the video dimension from the image width and height.
width
- Must be greater than 0.height
- Must be greater than 0.public java.awt.Dimension getVideoDimension()
Returns null if the dimension is not known.
public void writeFrame(java.awt.image.BufferedImage image) throws java.io.IOException
If the dimension of the video track has not been specified yet, it is derived from the first buffered image added to the AVIOutputStreamOLD.
image
- The frame image.java.lang.IllegalArgumentException
- if the duration is less than 1, or
if the dimension of the frame does not match the dimension of the video
track.java.io.IOException
- if writing the image failed.public void writeFrame(java.io.File file) throws java.io.IOException
This method does not inspect the contents of the file. For example, Its your responsibility to only add JPG files if you have chosen the JPEG video format.
If you add all frames from files or from input streams, then you have to explicitly set the dimension of the video track before you call finish() or close().
file
- The file which holds the image data.java.lang.IllegalStateException
- if the duration is less than 1.java.io.IOException
- if writing the image failed.public void writeFrame(java.io.InputStream in) throws java.io.IOException
This method does not inspect the contents of the file. For example, its your responsibility to only add JPG files if you have chosen the JPEG video format.
If you add all frames from files or from input streams, then you have to explicitly set the dimension of the video track before you call finish() or close().
in
- The input stream which holds the image data.java.lang.IllegalArgumentException
- if the duration is less than 1.java.io.IOException
- if writing the image failed.public void close() throws java.io.IOException
java.io.IOException
- if an I/O error has occurredpublic void finish() throws java.io.IOException
java.lang.IllegalStateException
- if the dimension of the video track
has not been specified or determined yet.java.io.IOException
- if an I/O exception has occurred