public class AVIWriter extends AVIOutputStream implements MovieWriter
AVIOutputStream.States
AbstractAVIStream.AudioTrack, AbstractAVIStream.AVIMediaType, AbstractAVIStream.Chunk, AbstractAVIStream.CompositeChunk, AbstractAVIStream.DataChunk, AbstractAVIStream.FixedSizeDataChunk, AbstractAVIStream.MainHeader, AbstractAVIStream.MidiTrack, AbstractAVIStream.Sample, AbstractAVIStream.TextTrack, AbstractAVIStream.Track, AbstractAVIStream.VideoTrack
Modifier and Type | Field and Description |
---|---|
static Format |
AVI |
static Format |
VIDEO_JPEG |
static Format |
VIDEO_PNG |
static Format |
VIDEO_RAW |
static Format |
VIDEO_RLE |
static Format |
VIDEO_SCREEN_CAPTURE |
aviChunk, avihChunk, moviChunk, state
AVI_ID, AVIH_FLAG_COPYRIGHTED, AVIH_FLAG_HAS_INDEX, AVIH_FLAG_IS_INTERLEAVED, AVIH_FLAG_MUST_USE_INDEX, AVIH_FLAG_TRUST_CK_TYPE, AVIH_FLAG_WAS_CAPTURE_FILE, AVIH_ID, AVIX_ID, CHUNK_SUBTYPE_MASK, DB_ID, DC_ID, HDRL_ID, IDX1_ID, LIST_ID, MOVI_ID, out, PC_ID, REC_ID, RIFF_ID, STRD_ID, streamOffset, STRF_ID, STRH_FLAG_DISABLED, STRH_FLAG_VIDEO_PALETTE_CHANGES, STRH_ID, STRL_ID, STRN_ID, tracks, WB_ID
Constructor and Description |
---|
AVIWriter(java.io.File file)
Creates a new AVI writer.
|
AVIWriter(javax.imageio.stream.ImageOutputStream out)
Creates a new AVI writer.
|
Modifier and Type | Method and Description |
---|---|
int |
addTrack(Format format)
Adds a track.
|
Codec |
getCodec(int track)
Returns the codec of the specified track.
|
Rational |
getDuration(int track)
Returns the media duration of the track in seconds.
|
Format |
getFileFormat()
Returns the file format.
|
Format |
getFormat(int track)
Returns the media format of the specified track.
|
int |
getTrackCount()
Returns the number of tracks.
|
boolean |
isEmpty(int track)
Returns true if the specified track has no samples.
|
boolean |
isVFRSupported() |
void |
setCodec(int track,
Codec codec)
Sets the codec for the specified track.
|
void |
write(int track,
Buffer buf)
Encodes the data provided in the buffer and then writes it into the
specified track.
|
void |
write(int track,
java.awt.image.BufferedImage image,
long duration)
Encodes the provided image and writes its sample data into the specified
track.
|
addAudioTrack, addVideoTrack, close, ensureFinished, ensureStarted, finish, getCompressionQuality, getExtraHeaderFourCCs, getMediaDuration, getVideoDimension, isDataLimitReached, putExtraHeader, setCompressionQuality, setName, setPalette, writePalette, writeSample, writeSample, writeSample, writeSamples
getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToInt
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isDataLimitReached
public static final Format AVI
public static final Format VIDEO_RAW
public static final Format VIDEO_JPEG
public static final Format VIDEO_PNG
public static final Format VIDEO_RLE
public static final Format VIDEO_SCREEN_CAPTURE
public AVIWriter(java.io.File file) throws java.io.IOException
file
- the output filejava.io.IOException
public AVIWriter(javax.imageio.stream.ImageOutputStream out) throws java.io.IOException
out
- the output stream.java.io.IOException
public Format getFileFormat() throws java.io.IOException
MovieWriter
getFileFormat
in interface MovieWriter
java.io.IOException
public Format getFormat(int track)
MovieWriter
MovieWriter.addTrack(org.monte.media.Format)
.getFormat
in interface MovieWriter
track
- Track number.public Rational getDuration(int track)
getDuration
in interface MovieWriter
public int addTrack(Format format) throws java.io.IOException
addTrack
in interface MovieWriter
format
- The format of the track.java.io.IOException
public Codec getCodec(int track)
public void setCodec(int track, Codec codec)
public int getTrackCount()
MovieWriter
getTrackCount
in interface MovieWriter
public void write(int track, java.awt.image.BufferedImage image, long duration) throws java.io.IOException
track
- The track index.image
- The image of the video frame.duration
- Duration given in media time units.IndexOutofBoundsException
- if the track index is out of bounds.if
- the duration is less than 1, or if the dimension of the frame
does not match the dimension of the video.java.lang.UnsupportedOperationException
- if the MovieWriter
does not
have a built-in encoder for this video format.java.io.IOException
- if writing the sample data failed.public void write(int track, Buffer buf) throws java.io.IOException
Does nothing if the discard-flag in the buffer is set to true.
write
in interface MovieWriter
write
in interface Multiplexer
track
- The track number.buf
- The buffer containing a data sample.java.io.IOException
public boolean isVFRSupported()
public boolean isEmpty(int track)
MovieWriter
isEmpty
in interface MovieWriter