ByteBuffer[] inputBuffers = mediaCodec.getInputBuffers();
int inputBufferIndex = mediaCodec.dequeueInputBuffer(0);
if (inputBufferIndex >= 0) {
ByteBuffer inputBuffer = inputBuffers[inputBufferIndex];
inputBuffer.clear();
inputBuffer.remaining(); // != 115200 !?!?!?
inputBuffer.put(pixelBuffer);
}
I meet the similar problem to you. I want to decode a mp4 video file to get the raw video frame. Now I can get the right result on AVD, and know the format of the raw video frame is YUV420p. But when I run the same code to decode the same video on nexus 4, the color format and buffer length are all wrong. It shows as follows:On nexus 4: {height=180, what=1869968451, color-format=2141391875, slice-height=192, crop-left=0, width=320, crop-bottom=179, crop-top=0, mime=video/raw, stride=384, crop-right=319}On AVD: {height=192, what=1869968451, color-format=19, slice-height=192, crop-left=0, width=320, crop-bottom=179, crop-top=0, mime=video/raw, stride=320, crop-right=319}I found that the INFO_OUTPUT_BUFFERS_CHANGED is never called on nexus 4, but it will be called on AVD before INFO_OUTPUT_FORMAT_CHANGED. Have you found the answer and known why?