VP8 Encoding Nexus 5 returns empty/0-Frames

社会主义新天地 提交于 2019-11-29 12:49:46

MediaCodec doesn't put the ByteBuffer in the correct position. You need to position it manually after the call to dequeueOutputBuffer():

int encoderStatus = encoder.dequeueOutputBuffer(info, TIMEOUT_USEC);
...
ByteBuffer encodedData = encoderOutputBuffers[encoderStatus];
encodedData.position(info.offset);
encodedData.limit(info.offset + info.size);

(See EncodeDecodeTest.) That's not the same as rewind(), though I'm a little surprised that didn't work -- I would have expected that output would usually start at the beginning of the buffer.

There are some known issues with VP8 on Android 4.3, though you don't seem to be hitting those.

If this does not fix your issue, it would be helpful to know the device you're using (S3 for both Android and Cyanogen?), the Android software version, to see the code you're using to configure() the MediaCodec, and what values are used.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!