Class MediaEncoder

java.lang.Object
javaforce.media.MediaCoder
javaforce.media.MediaEncoder

public class MediaEncoder extends MediaCoder
Media encoder.
Author:
pquiring
  • Field Details

    • fps_1000_1001

      public boolean fps_1000_1001
    • framesPerKeyFrame

      public int framesPerKeyFrame
    • videoBitRate

      public int videoBitRate
    • audioBitRate

      public int audioBitRate
    • compressionLevel

      public int compressionLevel
    • profileLevel

      public int profileLevel
  • Constructor Details

    • MediaEncoder

      public MediaEncoder()
  • Method Details

    • start

      public boolean start(MediaIO io, int width, int height, int fps, int chs, int freq, String codec, boolean doVideo, boolean doAudio)
    • set1000over1001

      public void set1000over1001(boolean state)
      Sets frame rate = fps * 1000 / 1001 (default = false)
    • setFramesPerKeyFrame

      public void setFramesPerKeyFrame(int count)
      Sets frames per key frame (gop) (default = 12)
    • setVideoBitRate

      public void setVideoBitRate(int rate)
      Sets video bit rate (default = 400000 bits/sec)
    • setAudioBitRate

      public void setAudioBitRate(int rate)
      Sets audio bit rate (default = 128000 bits/sec)
    • setCompressionLevel

      public void setCompressionLevel(int level)
      Sets compression level (meaning varies per codec) (default = -1)
    • setProfileLevel

      public void setProfileLevel(int level)
      Sets profile level (1=baseline 2=main 3=pro)
    • addAudio

      public boolean addAudio(short[] sams, int offset, int length)
    • addAudio

      public boolean addAudio(short[] sams)
    • addVideo

      public boolean addVideo(int[] px)
    • getAudioFramesize

      public int getAudioFramesize()
    • getLastDTS

      public long getLastDTS()
    • getLastPTS

      public long getLastPTS()
    • addAudioEncoded

      public boolean addAudioEncoded(byte[] packet, int offset, int length)
      Adds pre encoded audio.
    • addVideoEncoded

      public boolean addVideoEncoded(byte[] packet, int offset, int length, boolean key_frame)
      Adds pre encoded video.
    • addAudioEncodedTS

      public boolean addAudioEncodedTS(byte[] packet, int offset, int length, long dts, long pts)
      Adds pre encoded audio.
    • addVideoEncodedTS

      public boolean addVideoEncodedTS(byte[] packet, int offset, int length, boolean key_frame, long dts, long pts)
      Adds pre encoded video.
    • flush

      public void flush()
    • stop

      public void stop()
    • getCodecMimeType

      public String getCodecMimeType(String codec, boolean doVideo, boolean doAudio)
      Returns codecs mimetype.