public VideoEncoderCore(int width,int height,int bitRate,File outputFile) throws IOException {
  mBufferInfo=new MediaCodec.BufferInfo();
  MediaFormat format=MediaFormat.createVideoFormat(MIME_TYPE,width,height);
  format.setInteger(MediaFormat.KEY_COLOR_FORMAT,MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
  format.setInteger(MediaFormat.KEY_BIT_RATE,bitRate);
  format.setInteger(MediaFormat.KEY_FRAME_RATE,FRAME_RATE);
  format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,IFRAME_INTERVAL);
  if (VERBOSE)   Log.d(TAG,"format: " + format);
  mEncoder=MediaCodec.createEncoderByType(MIME_TYPE);
  mEncoder.configure(format,null,null,MediaCodec.CONFIGURE_FLAG_ENCODE);
  mInputSurface=mEncoder.createInputSurface();
  mEncoder.start();
  mMuxer=new MediaMuxer(outputFile.toString(),MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
  mTrackIndex=-1;
  mMuxerStarted=false;
}

public VideoEncoderCore ( int width , int height , int bitRate , File outputFile ) throws IOException { mBufferInfo = new MediaCodec . BufferInfo ( ) ; MediaFormat format = MediaFormat . createVideoFormat ( MIME_TYPE , width , height ) ; format . setInteger ( MediaFormat . KEY_COLOR_FORMAT , MediaCodecInfo . CodecCapabilities . COLOR_FormatSurface ) ; format . setInteger ( MediaFormat . KEY_BIT_RATE , bitRate ) ; format . setInteger ( MediaFormat . KEY_FRAME_RATE , FRAME_RATE ) ; format . setInteger ( MediaFormat . KEY_I_FRAME_INTERVAL , IFRAME_INTERVAL ) ; if ( VERBOSE ) Log . d ( TAG , "format: " + format ) ; mEncoder = MediaCodec . createEncoderByType ( MIME_TYPE ) ; mEncoder . configure ( format , null , null , MediaCodec . CONFIGURE_FLAG_ENCODE ) ; mInputSurface = mEncoder . createInputSurface ( ) ; mEncoder . start ( ) ; mMuxer = new MediaMuxer ( outputFile . toString ( ) , MediaMuxer . OutputFormat . MUXER_OUTPUT_MPEG_4 ) ; mTrackIndex = - 1 ; mMuxerStarted = false ; }
configures encoder and muxer state , and prepares the input surface .
