I am first decoding an audio with MediaExtractor
and MediaCodec
class and then encoding it in AAC using MediaCodec
class (added adts headers). The generated audio is noticeably slower in speed than the original. The audio also gets a little dim. I am using following preferences to set my encoder:
format.setInteger(MediaFormat.KEY_AAC_PROFILE,
MediaCodecInfo.CodecProfileLevel.AACObjectLC);
format.setInteger(MediaFormat.KEY_SAMPLE_RATE, 44100);
format.setInteger(MediaFormat.KEY_BIT_RATE, 128 * 1024);
format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 2);
Is there a way I can get a better encoded audio which matches the original audio?