MediaCodec H264 Encoder not working on Snapdragon 800 devices MediaCodec H264 Encoder not working on Snapdragon 800 devices android android

MediaCodec H264 Encoder not working on Snapdragon 800 devices


You need to set the presentationTimeUs parameter in your call to queueInputBuffer.Most encoders ignore this and you can encode for streaming without issues. The encoder used for Snapdragon 800 devices doesn't.

This parameter represents the recording time of your frame and needs therefore to increase by the number of us between the frame that you want to encode and the previous frame.

If the parameter set is the same value as in the previous frame the encoder drops it.If the parameter is set to a too small value (e.g. 100000 on a 30 FPS recording) the quality of the encoded frames drops.


encodeCodec.queueInputBuffer(inputBufferIndex, 0, input.length, (System.currentTimeMillis() - startMs) * 1000, 0);