Class AVIWriter

All Implemented Interfaces:
AutoCloseable, MovieWriter, Multiplexer

public class AVIWriter extends AVIOutputStream implements MovieWriter
Provides high-level support for encoding and writing audio and video samples into an AVI 1.0 file.
Author:
Werner Randelshofer
  • Field Details

    • AVI

      public static final Format AVI
    • VIDEO_RAW

      public static final Format VIDEO_RAW
    • VIDEO_JPEG

      public static final Format VIDEO_JPEG
    • VIDEO_PNG

      public static final Format VIDEO_PNG
    • VIDEO_RLE

      public static final Format VIDEO_RLE
    • VIDEO_SCREEN_CAPTURE

      public static final Format VIDEO_SCREEN_CAPTURE
  • Constructor Details

  • Method Details

    • getFileFormat

      public Format getFileFormat() throws IOException
      Description copied from interface: MovieWriter
      Returns the file format.
      Specified by:
      getFileFormat in interface MovieWriter
      Throws:
      IOException
    • getFormat

      public Format getFormat(int track)
      Description copied from interface: MovieWriter
      Returns the media format of the specified track. This is a refined version of the format that was requested when the track was added. See MovieWriter.addTrack(org.monte.media.av.Format).
      Specified by:
      getFormat in interface MovieWriter
      Parameters:
      track - Track number.
      Returns:
      The media format of the track.
    • getDuration

      public Rational getDuration(int track)
      Returns the media duration of the track in seconds.
      Specified by:
      getDuration in interface MovieWriter
    • addTrack

      public int addTrack(Format format) throws IOException
      Adds a track.
      Specified by:
      addTrack in interface MovieWriter
      Parameters:
      format - The format of the track.
      Returns:
      The track number.
      Throws:
      IOException
    • getCodec

      public Codec getCodec(int track)
      Returns the codec of the specified track.
    • setCodec

      public void setCodec(int track, Codec codec)
      Sets the codec for the specified track.
    • getTrackCount

      public int getTrackCount()
      Description copied from interface: MovieWriter
      Returns the number of tracks.
      Specified by:
      getTrackCount in interface MovieWriter
    • write

      public void write(int track, BufferedImage image, long duration) throws IOException
      Encodes the provided image and writes its sample data into the specified track.
      Parameters:
      track - The track index.
      image - The image of the video frame.
      duration - Duration given in media time units (=number of frames to be written).
      Throws:
      IOException - if writing the sample data failed.
    • write

      public void write(int track, Buffer buf) throws IOException
      Encodes the data provided in the buffer and then writes it into the specified track.

      Does nothing if the discard-flag in the buffer is set to true.

      Specified by:
      write in interface MovieWriter
      Specified by:
      write in interface Multiplexer
      Parameters:
      track - The track number.
      buf - The buffer containing a data sample. The duration of the buffer must match the sample rate of the track.
      Throws:
      IOException - if the write fails
    • isVFRSupported

      public boolean isVFRSupported()
    • isEmpty

      public boolean isEmpty(int track)
      Description copied from interface: MovieWriter
      Returns true if the specified track has no samples.
      Specified by:
      isEmpty in interface MovieWriter