Class Frame

java.lang.Object
com.github.kokorin.jaffree.ffmpeg.Frame

public class Frame extends Object
Represents video/audio data to be encoded or has been decoded. Note: image and samples must not be changed after creating Frame instance. Otherwise it may affect (or event corrupt) produced media, because Jaffree internally maintains frame reordering buffer while producing video.
See Also:
  • Constructor Details

    • Frame

      protected Frame(int streamId, long pts, BufferedImage image, int[] samples)
      Creates Frame.
      Parameters:
      streamId - streamId
      pts - pts in Stream timebase
      image - video frame image
      samples - audio samples in PCM S32BE format
      See Also:
  • Method Details

    • getStreamId

      public int getStreamId()
      Returns:
      stream id (starting with 0)
    • getPts

      public long getPts()
      PTS in corresponding Stream timebase. E.g. Track's timebase is 44100 (audio track), timecode is 4410 - it means 0.1 second (100 milliseconds)
      Returns:
      timecode
      See Also:
    • getImage

      public BufferedImage getImage()
      Returns video frame image (or null if current frame isn't video frame).
      Returns:
      video frame image
    • getSamples

      public int[] getSamples()
      Returns audio samples (or null if current frame isn't audio frame).
      Returns:
      audio samples in PCM S32BE format
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createVideoFrame

      public static Frame createVideoFrame(int streamId, long pts, BufferedImage image)
      Creates video Frame, samples are set to null.
      Parameters:
      streamId - stream id (starting with 0)
      pts - pts in Stream timebase
      image - video frame image
      Returns:
      video Frame
      See Also:
    • createAudioFrame

      public static Frame createAudioFrame(int streamId, long pts, int[] samples)
      Creates audio Frame, image is set to null.
      Parameters:
      streamId - streamId
      pts - pts in Stream timebase
      samples - audio samples in PCM S32BE format
      Returns:
      audio Frame
      See Also: